diff --git a/Live/CWX_BushWhacker/CWX-BushWhacker 1.2.3/bepInEx/plugins/CWX-BushWhacker.dll b/Live/CWX_BushWhacker/CWX-BushWhacker 1.2.4/bepInEx/plugins/CWX-BushWhacker.dll similarity index 86% rename from Live/CWX_BushWhacker/CWX-BushWhacker 1.2.3/bepInEx/plugins/CWX-BushWhacker.dll rename to Live/CWX_BushWhacker/CWX-BushWhacker 1.2.4/bepInEx/plugins/CWX-BushWhacker.dll index eb743a6..f89386f 100644 Binary files a/Live/CWX_BushWhacker/CWX-BushWhacker 1.2.3/bepInEx/plugins/CWX-BushWhacker.dll and b/Live/CWX_BushWhacker/CWX-BushWhacker 1.2.4/bepInEx/plugins/CWX-BushWhacker.dll differ diff --git a/Live/CWX_BushWhacker/CWX-BushWhacker 1.2.3/user/mods/CWX-BushWhacker 1.2.3/LICENSE.txt b/Live/CWX_BushWhacker/CWX-BushWhacker 1.2.4/user/mods/CWX-BushWhacker 1.2.4/LICENSE.txt similarity index 100% rename from Live/CWX_BushWhacker/CWX-BushWhacker 1.2.3/user/mods/CWX-BushWhacker 1.2.3/LICENSE.txt rename to Live/CWX_BushWhacker/CWX-BushWhacker 1.2.4/user/mods/CWX-BushWhacker 1.2.4/LICENSE.txt diff --git a/Live/CWX_BushWhacker/CWX-BushWhacker 1.2.3/user/mods/CWX-BushWhacker 1.2.3/package.json b/Live/CWX_BushWhacker/CWX-BushWhacker 1.2.4/user/mods/CWX-BushWhacker 1.2.4/package.json similarity index 95% rename from Live/CWX_BushWhacker/CWX-BushWhacker 1.2.3/user/mods/CWX-BushWhacker 1.2.3/package.json rename to Live/CWX_BushWhacker/CWX-BushWhacker 1.2.4/user/mods/CWX-BushWhacker 1.2.4/package.json index 2ada0a4..51136cc 100644 --- a/Live/CWX_BushWhacker/CWX-BushWhacker 1.2.3/user/mods/CWX-BushWhacker 1.2.3/package.json +++ b/Live/CWX_BushWhacker/CWX-BushWhacker 1.2.4/user/mods/CWX-BushWhacker 1.2.4/package.json @@ -1,10 +1,10 @@ { "name": "BushWhacker", "author": "CWX", - "version": "1.2.3", + "version": "1.2.4", "license": "NCSA", "main": "src/mod.js", - "akiVersion": "3.2.2", + "akiVersion": "3.2.3", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" ./**/*.* ./dist", diff --git a/Live/CWX_BushWhacker/CWX-BushWhacker 1.2.3/user/mods/CWX-BushWhacker 1.2.3/src/mod.ts b/Live/CWX_BushWhacker/CWX-BushWhacker 1.2.4/user/mods/CWX-BushWhacker 1.2.4/src/mod.ts similarity index 100% rename from Live/CWX_BushWhacker/CWX-BushWhacker 1.2.3/user/mods/CWX-BushWhacker 1.2.3/src/mod.ts rename to Live/CWX_BushWhacker/CWX-BushWhacker 1.2.4/user/mods/CWX-BushWhacker 1.2.4/src/mod.ts diff --git a/Live/CWX_BushWhacker/CWX_BushWhacker.csproj b/Live/CWX_BushWhacker/CWX_BushWhacker.csproj index 12d38bc..3d095f3 100644 --- a/Live/CWX_BushWhacker/CWX_BushWhacker.csproj +++ b/Live/CWX_BushWhacker/CWX_BushWhacker.csproj @@ -3,7 +3,7 @@ net472 CWX-BushWhacker - 1.1.0 + 1.2.4 diff --git a/Live/CWX_BushWhacker/Plugin.cs b/Live/CWX_BushWhacker/Plugin.cs index c05d74c..4a1f644 100644 --- a/Live/CWX_BushWhacker/Plugin.cs +++ b/Live/CWX_BushWhacker/Plugin.cs @@ -5,7 +5,7 @@ using UnityEngine; namespace BushWhacker { - [BepInPlugin("com.cwx.bushwhacker", "cwx-bushwhacker", "1.2.0")] + [BepInPlugin("com.cwx.bushwhacker", "cwx-bushwhacker", "1.2.4")] public class BushWhacker : BaseUnityPlugin { public void Start() diff --git a/Live/CWX_BushWhacker/README.md b/Live/CWX_BushWhacker/README.md index 80d4d89..dd11d5f 100644 --- a/Live/CWX_BushWhacker/README.md +++ b/Live/CWX_BushWhacker/README.md @@ -1,5 +1,5 @@ # BushWhacker ## CWX-BushWhacker for EFT - SPT-AKI -### CURRENT AKI VERSION: 2.3.1 -### GAMEVERSION: 0.12.12.17349 +### CURRENT AKI VERSION: 3.2.3 +### GAMEVERSION: 0.12.12.31.19428 ### USING BEPINEX diff --git a/Live/CWX_BushWhacker/server/dist/package.json b/Live/CWX_BushWhacker/server/dist/package.json index 2ada0a4..51136cc 100644 --- a/Live/CWX_BushWhacker/server/dist/package.json +++ b/Live/CWX_BushWhacker/server/dist/package.json @@ -1,10 +1,10 @@ { "name": "BushWhacker", "author": "CWX", - "version": "1.2.3", + "version": "1.2.4", "license": "NCSA", "main": "src/mod.js", - "akiVersion": "3.2.2", + "akiVersion": "3.2.3", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" ./**/*.* ./dist", diff --git a/Live/CWX_BushWhacker/server/dist/types/callbacks/InsuranceCallbacks.d.ts b/Live/CWX_BushWhacker/server/dist/types/callbacks/InsuranceCallbacks.d.ts index 6819960..8835ba2 100644 --- a/Live/CWX_BushWhacker/server/dist/types/callbacks/InsuranceCallbacks.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/callbacks/InsuranceCallbacks.d.ts @@ -1,5 +1,5 @@ import { InsuranceController } from "../controllers/InsuranceController"; -import { OnLoadOnUpdate } from "../di/OnLoadOnUpdate"; +import { OnUpdate } from "../di/OnUpdate"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData"; @@ -10,14 +10,13 @@ import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { InsuranceService } from "../services/InsuranceService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -export declare class InsuranceCallbacks extends OnLoadOnUpdate { +export declare class InsuranceCallbacks extends OnUpdate { protected insuranceController: InsuranceController; protected insuranceService: InsuranceService; protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); - onLoad(): void; getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; diff --git a/Live/CWX_BushWhacker/server/dist/types/callbacks/LocationCallbacks.d.ts b/Live/CWX_BushWhacker/server/dist/types/callbacks/LocationCallbacks.d.ts index cc69369..6e0b538 100644 --- a/Live/CWX_BushWhacker/server/dist/types/callbacks/LocationCallbacks.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/callbacks/LocationCallbacks.d.ts @@ -11,4 +11,5 @@ export declare class LocationCallbacks { constructor(httpResponse: HttpResponseUtil, locationController: LocationController); getLocationData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocation(url: string, info: IGetLocationRequestData, sessionID: string): IGetBodyResponseData; + getAirdropLoot(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/Live/CWX_BushWhacker/server/dist/types/callbacks/ProfileCallbacks.d.ts b/Live/CWX_BushWhacker/server/dist/types/callbacks/ProfileCallbacks.d.ts index 6a86fc0..183bb0a 100644 --- a/Live/CWX_BushWhacker/server/dist/types/callbacks/ProfileCallbacks.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/callbacks/ProfileCallbacks.d.ts @@ -1,5 +1,6 @@ import { ProfileController } from "../controllers/ProfileController"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IGetMiniProfileRequestData } from "../models/eft/launcher/IGetMiniProfileRequestData"; @@ -12,20 +13,51 @@ import { ISearchFriendResponse } from "../models/eft/profile/ISearchFriendRespon import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** Handle profile related client events */ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); createProfile(url: string, info: IProfileCreateRequestData, sessionID: string): IGetBodyResponseData; - getProfileData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - regenerateScav(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Get the complete player profile (scav + pmc character) + * @param url + * @param info Empty + * @param sessionID Session id + * @returns Profile object + */ + getProfileData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle the creation of a scav profile for player + * Occurs post-raid and when profile first created immediately after character details are confirmed by player + * @param url + * @param info empty + * @param sessionID Session id + * @returns Profile object + */ + regenerateScav(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/profile/voice/change event + * @param url + * @param info Change voice request object + * @param sessionID Session id + * @returns Client response + */ changeVoice(url: string, info: IProfileChangeVoiceRequestData, sessionID: string): INullResponseData; + /** + * Handle client/game/profile/nickname/change event + * Client allows player to adjust their profile name + * @param url + * @param info Change nickname request object + * @param sessionID Session id + * @returns client response + */ changeNickname(url: string, info: IProfileChangeNicknameRequestData, sessionID: string): IGetBodyResponseData; validateNickname(url: string, info: IValidateNicknameRequestData, sessionID: string): IGetBodyResponseData; getReservedNickname(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** - * Called when creating a character, when you choose a character face/voice + * Called when creating a character when choosing a character face/voice * @param url * @param info response (empty) * @param sessionID diff --git a/Live/CWX_BushWhacker/server/dist/types/callbacks/RagfairCallbacks.d.ts b/Live/CWX_BushWhacker/server/dist/types/callbacks/RagfairCallbacks.d.ts index 3a405c9..c609f2f 100644 --- a/Live/CWX_BushWhacker/server/dist/types/callbacks/RagfairCallbacks.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/callbacks/RagfairCallbacks.d.ts @@ -19,6 +19,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; +/** + * Handle ragfair related callback events + */ export declare class RagfairCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; protected logger: ILogger; diff --git a/Live/CWX_BushWhacker/server/dist/types/callbacks/RepairCallbacks.d.ts b/Live/CWX_BushWhacker/server/dist/types/callbacks/RepairCallbacks.d.ts index 63733fa..14edeeb 100644 --- a/Live/CWX_BushWhacker/server/dist/types/callbacks/RepairCallbacks.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/callbacks/RepairCallbacks.d.ts @@ -6,6 +6,20 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa export declare class RepairCallbacks { protected repairController: RepairController; constructor(repairController: RepairController); + /** + * use trader to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + /** + * Use repair kit to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ repair(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/Live/CWX_BushWhacker/server/dist/types/callbacks/TraderCallbacks.d.ts b/Live/CWX_BushWhacker/server/dist/types/callbacks/TraderCallbacks.d.ts index 128d9b2..e4fd099 100644 --- a/Live/CWX_BushWhacker/server/dist/types/callbacks/TraderCallbacks.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/callbacks/TraderCallbacks.d.ts @@ -9,10 +9,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); onLoad(): void; + onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - onUpdate(): boolean; } diff --git a/Live/CWX_BushWhacker/server/dist/types/context/ContextVariable.d.ts b/Live/CWX_BushWhacker/server/dist/types/context/ContextVariable.d.ts index e438947..0fe0a63 100644 --- a/Live/CWX_BushWhacker/server/dist/types/context/ContextVariable.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/context/ContextVariable.d.ts @@ -4,7 +4,7 @@ export declare class ContextVariable { private timestamp; private type; constructor(value: any, type: ContextVariableType); - getValue(): any; + getValue(): T; getTimestamp(): Date; getType(): ContextVariableType; } diff --git a/Live/CWX_BushWhacker/server/dist/types/controllers/BotController.d.ts b/Live/CWX_BushWhacker/server/dist/types/controllers/BotController.d.ts index 5e6f05d..a5111d5 100644 --- a/Live/CWX_BushWhacker/server/dist/types/controllers/BotController.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/controllers/BotController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotHelper } from "../helpers/BotHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; @@ -5,15 +6,22 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { IBotCore } from "../models/eft/common/tables/IBotCore"; import { Difficulty } from "../models/eft/common/tables/IBotType"; import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; +import { PmcAiService } from "../services/PmcAiService"; export declare class BotController { + protected logger: ILogger; protected databaseServer: DatabaseServer; protected botGenerator: BotGenerator; protected botHelper: BotHelper; + protected pmcAiService: PmcAiService; + protected botGenerationCacheService: BotGenerationCacheService; protected configServer: ConfigServer; + protected applicationContext: ApplicationContext; protected botConfig: IBotConfig; - constructor(databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -29,7 +37,18 @@ export declare class BotController { * @returns Difficulty object */ getBotDifficulty(type: string, difficulty: string): Difficulty; - protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string): Difficulty; + protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Generate bot profiles and store in cache + * @param sessionId Session id + * @param info bot generation request info + * @returns IBotBase array + */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the max number of bots allowed on a map + * Looks up location player is entering when getting cap value + * @returns cap number + */ getBotCap(): number; } diff --git a/Live/CWX_BushWhacker/server/dist/types/controllers/GameController.d.ts b/Live/CWX_BushWhacker/server/dist/types/controllers/GameController.d.ts index 85ec418..2d00898 100644 --- a/Live/CWX_BushWhacker/server/dist/types/controllers/GameController.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/controllers/GameController.d.ts @@ -7,11 +7,13 @@ import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; protected localeService: LocaleService; @@ -20,9 +22,14 @@ export declare class GameController { protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + /** + * Make non-trigger-spawned raiders spawn earlier + always + */ + protected adjustLabsRaiderSpawnRate(): void; protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; + getValidGameVersion(): any; } diff --git a/Live/CWX_BushWhacker/server/dist/types/controllers/HideoutController.d.ts b/Live/CWX_BushWhacker/server/dist/types/controllers/HideoutController.d.ts index 3eefe1a..dcd8894 100644 --- a/Live/CWX_BushWhacker/server/dist/types/controllers/HideoutController.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/controllers/HideoutController.d.ts @@ -28,6 +28,7 @@ import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,9 +46,10 @@ export declare class HideoutController { protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/Live/CWX_BushWhacker/server/dist/types/controllers/InraidController.d.ts b/Live/CWX_BushWhacker/server/dist/types/controllers/InraidController.d.ts index b899e7d..102a2fb 100644 --- a/Live/CWX_BushWhacker/server/dist/types/controllers/InraidController.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/controllers/InraidController.d.ts @@ -5,9 +5,11 @@ import { ItemHelper } from "../helpers/ItemHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; @@ -15,6 +17,7 @@ import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class InraidController { + protected logger: ILogger; protected saveServer: SaveServer; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; @@ -29,16 +32,40 @@ export declare class InraidController { protected inRaidHelper: InRaidHelper; protected configServer: ConfigServer; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Handle updating the profile post-pmc raid + * @param sessionID session id + * @param offraidData post-raid data of raid + */ + protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Reduce body part hp to % of max + * @param pmcData profile to edit + * @param multipler multipler to apply to max health + */ + protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + /** + * Handle updating the profile post-pscav raid + * @param sessionID session id + * @param offraidData post-raid data of raid + */ + protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Is the player dead after a raid - dead is anything other than "survived" / "runner" + * @param statusOnExit exit value from offraidData object + * @returns true if dead + */ + protected isPlayerDead(statusOnExit: string): boolean; /** * Mark inventory items as FiR if player survived raid, otherwise remove FiR from them * @param offraidData Save Progress Request * @param pmcData player profile * @param isPlayerScav Was the player a pScav */ - private markOrRemoveFoundInRaidItems; - private handlePostRaidPlayerScavProcess; - private handlePostRaidPlayerScavKarmaChanges; + protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; } diff --git a/Live/CWX_BushWhacker/server/dist/types/controllers/InventoryController.d.ts b/Live/CWX_BushWhacker/server/dist/types/controllers/InventoryController.d.ts index f57f731..f564919 100644 --- a/Live/CWX_BushWhacker/server/dist/types/controllers/InventoryController.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/controllers/InventoryController.d.ts @@ -92,7 +92,11 @@ export declare class InventoryController { */ toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; /** - * Handles Tagging of items (primary Containers). + * Add a tag to an inventory item + * @param pmcData profile with item to add tag to + * @param body tag request data + * @param sessionID session id + * @returns client response object */ tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/Live/CWX_BushWhacker/server/dist/types/controllers/LocationController.d.ts b/Live/CWX_BushWhacker/server/dist/types/controllers/LocationController.d.ts index 90b6d7a..9db3205 100644 --- a/Live/CWX_BushWhacker/server/dist/types/controllers/LocationController.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/controllers/LocationController.d.ts @@ -1,18 +1,33 @@ import { LocationGenerator } from "../generators/LocationGenerator"; +import { LootGenerator } from "../generators/LootGenerator"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; +import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; +import { LootItem } from "../models/spt/services/LootItem"; import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class LocationController { protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected logger: ILogger; protected locationGenerator: LocationGenerator; + protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; - constructor(jsonUtil: JsonUtil, logger: ILogger, locationGenerator: LocationGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil); + protected configServer: ConfigServer; + protected airdropConfig: IAirdropConfig; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; generateAll(): ILocationsGenerateAllResponse; + /** + * Get loot for an airdop container + * Generates it randomly based on config/airdrop.json values + * @returns Array of LootItem + */ + getAirdropLoot(): LootItem[]; } diff --git a/Live/CWX_BushWhacker/server/dist/types/controllers/MatchController.d.ts b/Live/CWX_BushWhacker/server/dist/types/controllers/MatchController.d.ts index 71cb7d3..07f6a89 100644 --- a/Live/CWX_BushWhacker/server/dist/types/controllers/MatchController.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/controllers/MatchController.d.ts @@ -9,23 +9,33 @@ import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestDa import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; +import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { PmcAiService } from "../services/PmcAiService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { + protected logger: ILogger; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected matchLocationService: MatchLocationService; protected traderHelper: TraderHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; + protected profileSnapshotService: ProfileSnapshotService; + protected pmcAiService: PmcAiService; + protected botGenerationCacheService: BotGenerationCacheService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + protected botConfig: IBotConfig; + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/Live/CWX_BushWhacker/server/dist/types/controllers/QuestController.d.ts b/Live/CWX_BushWhacker/server/dist/types/controllers/QuestController.d.ts index 2cbccfb..282f50e 100644 --- a/Live/CWX_BushWhacker/server/dist/types/controllers/QuestController.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/controllers/QuestController.d.ts @@ -39,16 +39,31 @@ export declare class QuestController { * @returns array of IQuest */ getClientQuests(sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param side player side (usec/bear) + * @param questId questId to check + */ + protected questIsForOtherSide(side: string, questId: string): boolean; + /** + * Handle the client accepting a quest and starting it + * Send starting rewards if any to player and + * Send start notification if any to player + * @param pmcData Profile to update + * @param acceptedQuest Quest accepted + * @param sessionID Session id + * @returns client response + */ acceptQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; acceptRepeatableQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; /** - * Remove completed quest from profile + * Update completed quest in profile * Add newly unlocked quests to profile * Also recalculate thier level due to exp rewards * @param pmcData Player profile - * @param body completed quest request - * @param sessionID session id - * @returns ItemEvent response + * @param body Completed quest request + * @param sessionID Session id + * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -67,10 +82,20 @@ export declare class QuestController { protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the quests provided + * Update quest in profile, otherwise add fresh quest object with failed status * @param sessionID session id * @param pmcData player profile * @param questsToFail quests to fail */ protected failQuests(sessionID: string, pmcData: IPmcData, questsToFail: IQuest[]): void; handoverQuest(pmcData: IPmcData, body: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Increment a backend counter stored value by an amount, + * Create counter if it does not exist + * @param pmcData Profile to find backend counter in + * @param conditionId backend counter id to update + * @param questId quest id counter is associated with + * @param counterValue value to increment the backend counter with + */ + protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; } diff --git a/Live/CWX_BushWhacker/server/dist/types/controllers/RagfairController.d.ts b/Live/CWX_BushWhacker/server/dist/types/controllers/RagfairController.d.ts index c4ffc15..06af740 100644 --- a/Live/CWX_BushWhacker/server/dist/types/controllers/RagfairController.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/controllers/RagfairController.d.ts @@ -9,6 +9,7 @@ import { RagfairOfferHelper } from "../helpers/RagfairOfferHelper"; import { RagfairSellHelper } from "../helpers/RagfairSellHelper"; import { RagfairSortHelper } from "../helpers/RagfairSortHelper"; import { RagfairTaxHelper } from "../helpers/RagfairTaxHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; @@ -33,6 +34,9 @@ import { RagfairPriceService } from "../services/RagfairPriceService"; import { RagfairRequiredItemsService } from "../services/RagfairRequiredItemsService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** + * Handle RagfairCallback events + */ export declare class RagfairController { protected logger: ILogger; protected timeUtil: TimeUtil; @@ -52,14 +56,20 @@ export declare class RagfairController { protected handbookHelper: HandbookHelper; protected paymentHelper: PaymentHelper; protected inventoryHelper: InventoryHelper; + protected traderHelper: TraderHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected ragfairOfferGenerator: RagfairOfferGenerator; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + /** + * Update a trader flea offer with buy restrictions stored in the traders assort + * @param offer flea offer to update + */ + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer): void; protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; diff --git a/Live/CWX_BushWhacker/server/dist/types/controllers/RepairController.d.ts b/Live/CWX_BushWhacker/server/dist/types/controllers/RepairController.d.ts index 0e78ef6..ae54a53 100644 --- a/Live/CWX_BushWhacker/server/dist/types/controllers/RepairController.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/controllers/RepairController.d.ts @@ -8,9 +8,9 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa import { IRepairConfig } from "../models/spt/config/IRepairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; -import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { PaymentService } from "../services/PaymentService"; +import { RepairService } from "../services/RepairService"; export declare class RepairController { protected logger: ILogger; protected itemEventRouter: ItemEventRouter; @@ -19,23 +19,23 @@ export declare class RepairController { protected traderHelper: TraderHelper; protected paymentService: PaymentService; protected repairHelper: RepairHelper; - protected configServer: ConfigServer; + protected repairService: RepairService; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); /** * Repair with trader - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + traderRepair(sessionID: string, body: ITraderRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; /** * Repair with repair kit - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - repairWithKit(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + repairWithKit(sessionID: string, body: IRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; } diff --git a/Live/CWX_BushWhacker/server/dist/types/controllers/RepeatableQuestController.d.ts b/Live/CWX_BushWhacker/server/dist/types/controllers/RepeatableQuestController.d.ts index 98d05dd..4c31a3d 100644 --- a/Live/CWX_BushWhacker/server/dist/types/controllers/RepeatableQuestController.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/controllers/RepeatableQuestController.d.ts @@ -7,6 +7,7 @@ import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; import { TraderInfo } from "../models/eft/common/tables/IBotBase"; import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; import { ELocationName } from "../models/enums/ELocationName"; @@ -15,6 +16,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -64,9 +66,10 @@ export declare class RepeatableQuestController { protected itemEventRouter: ItemEventRouter; protected paymentService: PaymentService; protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. @@ -217,4 +220,16 @@ export declare class RepeatableQuestController { debugLogRepeatableQuestIds(pmcData: IPmcData): void; probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; changeRepeatableQuest(pmcDataIn: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {*} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; } diff --git a/Live/CWX_BushWhacker/server/dist/types/controllers/TraderController.d.ts b/Live/CWX_BushWhacker/server/dist/types/controllers/TraderController.d.ts index 7bab158..b79f55e 100644 --- a/Live/CWX_BushWhacker/server/dist/types/controllers/TraderController.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/controllers/TraderController.d.ts @@ -4,6 +4,7 @@ import { TraderHelper } from "../helpers/TraderHelper"; import { IBarterScheme, ITraderAssort, ITraderBase } from "../models/eft/common/tables/ITrader"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -15,12 +16,29 @@ export declare class TraderController { protected traderHelper: TraderHelper; protected timeUtil: TimeUtil; protected traderAssortService: TraderAssortService; + protected fenceService: FenceService; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, fenceService: FenceService, jsonUtil: JsonUtil); + /** + * Runs when onLoad event is fired + * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Store timestamp of next assort refresh in nextResupply property of traders .base object + */ load(): void; - getTrader(traderID: string, sessionID: string): ITraderBase; + /** + * Runs when onUpdate is fired + * If current time is > nextResupply(expire) time of trader, refresh traders assorts and + * Fence is handled slightly differently + * @returns has run + */ + update(): boolean; + /** + * Return an array of all traders + * @param sessionID Session id + * @returns array if ITraderBase objects + */ getAllTraders(sessionID: string): ITraderBase[]; - updateTraders(): boolean; + getTrader(sessionID: string, traderID: string): ITraderBase; getAssort(sessionId: string, traderId: string): ITraderAssort; - getPurchasesData(traderID: string, sessionID: string): Record; + getPurchasesData(sessionID: string, traderID: string): Record; } diff --git a/Live/CWX_BushWhacker/server/dist/types/di/Container.d.ts b/Live/CWX_BushWhacker/server/dist/types/di/Container.d.ts index 17791b0..98d1fa1 100644 --- a/Live/CWX_BushWhacker/server/dist/types/di/Container.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/di/Container.d.ts @@ -1,4 +1,7 @@ import { DependencyContainer } from "tsyringe"; +/** + * Handle the registration of classes to be used by the Dependency Injection code + */ export declare class Container { static registerTypes(depContainer: DependencyContainer): void; static registerListTypes(depContainer: DependencyContainer): void; diff --git a/Live/CWX_BushWhacker/server/dist/types/generators/BotGenerator.d.ts b/Live/CWX_BushWhacker/server/dist/types/generators/BotGenerator.d.ts index a5fc0ad..2ac51db 100644 --- a/Live/CWX_BushWhacker/server/dist/types/generators/BotGenerator.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/generators/BotGenerator.d.ts @@ -9,6 +9,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { PmcAiService } from "../services/PmcAiService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -30,9 +31,10 @@ export declare class BotGenerator { protected botEquipmentFilterService: BotEquipmentFilterService; protected botHelper: BotHelper; protected gameEventHelper: GameEventHelper; + protected pmcAiService: PmcAiService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, pmcAiService: PmcAiService, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -40,14 +42,14 @@ export declare class BotGenerator { * @param botTemplate base bot template to use (e.g. assault/pmcbot) * @returns */ - generatePlayerScav(role: string, difficulty: string, botTemplate: IBotType): IBotBase; - generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Choose if a bot should become a PMC by checking if bot type is allowed to become a Pmc in botConfig.convertFromChances and doing a random int check - * @param botRole the bot role to check if should be a pmc - * @returns true if should be a pmc + * Generate an array of bot objects for populate a raid with + * @param sessionId session id + * @param info request object + * @returns bot array */ - protected shouldBotBePmc(botRole: string): boolean; + generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** * Get a randomised PMC side based on bot config value 'isUsec' * @returns pmc side as string @@ -58,12 +60,30 @@ export declare class BotGenerator { * @returns IBotBase object */ protected getCloneOfBotBase(): IBotBase; - protected generateBot(bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + /** + * Create a IBotBase object with equipment/loot/exp etc + * @param sessionId Session id + * @param bot bots base file + * @param role botRole bot will use + * @param node Bot template from db/bots/x.json + * @param isPmc Is bot to be a PMC + * @param isPlayerScav is bot to be a p scav bot + * @returns IBotBase object + */ + protected generateBot(sessionId: string, bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; /** * Log the number of PMCs generated to the debug console + * @param output Generated bot array, ready to send to client */ protected logPmcGeneratedCount(output: IBotBase[]): void; - protected generateRandomLevel(min: number, max: number): BotGenerator.IRandomisedBotLevelResult; + /** + * Return a randomised bot level and exp value + * @param role botRole being generated for + * @param min Min exp value + * @param max Max exp value + * @returns IRandomisedBotLevelResult object + */ + protected generateRandomLevel(role: string, min: number, max: number): BotGenerator.IRandomisedBotLevelResult; /** * Converts health object to the required format * @param healthObj health object from bot json @@ -72,19 +92,23 @@ export declare class BotGenerator { */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; protected generateSkills(skillsObj: Skills): Skills; - /** - * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) - * @param pmcSide eft side (usec/bear) - * @returns pmc side as defined in config - */ - protected getPmcRole(pmcSide: string): string; /** * Iterate through bots inventory and loot to find and remove christmas items (as defined in GameEventHelper) * @param nodeInventory Bots inventory to iterate over */ protected removeChristmasItemsFromBotInventory(nodeInventory: Inventory): void; + /** + * Generate a random Id for a bot and apply to bots _id and aid value + * @param bot bot to update + * @returns updated IBotBase object + */ protected generateId(bot: IBotBase): IBotBase; protected generateInventoryID(profile: IBotBase): IBotBase; + /** + * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * @param requestedDifficulty + * @returns + */ protected getPMCDifficulty(requestedDifficulty: string): string; /** * Add a side-specific (usec/bear) dogtag item to a bots inventory diff --git a/Live/CWX_BushWhacker/server/dist/types/generators/BotInventoryGenerator.d.ts b/Live/CWX_BushWhacker/server/dist/types/generators/BotInventoryGenerator.d.ts index 35d1ee8..c5ed545 100644 --- a/Live/CWX_BushWhacker/server/dist/types/generators/BotInventoryGenerator.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/generators/BotInventoryGenerator.d.ts @@ -1,13 +1,16 @@ +import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Inventory, Chances, Generation, Mods } from "../models/eft/common/tables/IBotType"; +import { Chances, Generation, Inventory, Mods } from "../models/eft/common/tables/IBotType"; +import { EquipmentSlots } from "../models/enums/EquipmentSlots"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; -import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; -import { BotWeaponGenerator } from "./BotWeaponGenerator"; import { BotLootGenerator } from "./BotLootGenerator"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; +import { BotWeaponGenerator } from "./BotWeaponGenerator"; export declare class BotInventoryGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -17,8 +20,14 @@ export declare class BotInventoryGenerator { protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper); - generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { + slot: EquipmentSlots; + shouldSpawn: boolean; + }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; protected generateInventoryBase(): PmcInventory; } diff --git a/Live/CWX_BushWhacker/server/dist/types/generators/BotLootGenerator.d.ts b/Live/CWX_BushWhacker/server/dist/types/generators/BotLootGenerator.d.ts index c6a3f29..c1f5310 100644 --- a/Live/CWX_BushWhacker/server/dist/types/generators/BotLootGenerator.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/generators/BotLootGenerator.d.ts @@ -1,4 +1,5 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; @@ -20,11 +21,12 @@ export declare class BotLootGenerator { protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botLootCacheService: BotLootCacheService, configServer: ConfigServer); - generateLoot(templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer); + generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached @@ -47,7 +49,7 @@ export declare class BotLootGenerator { * @param botRole bots role, .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; /** * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from diff --git a/Live/CWX_BushWhacker/server/dist/types/generators/BotWeaponGenerator.d.ts b/Live/CWX_BushWhacker/server/dist/types/generators/BotWeaponGenerator.d.ts index 9215214..487901b 100644 --- a/Live/CWX_BushWhacker/server/dist/types/generators/BotWeaponGenerator.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/generators/BotWeaponGenerator.d.ts @@ -1,4 +1,5 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { MinMax } from "../models/common/MinMax"; @@ -14,6 +15,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { IInventoryMagGen } from "./weapongen/IInventoryMagGen"; export declare class BotWeaponGenerator { protected jsonUtil: JsonUtil; protected logger: ILogger; @@ -24,11 +26,24 @@ export declare class BotWeaponGenerator { protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; protected configServer: ConfigServer; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, inventoryMagGenComponents: IInventoryMagGen[]); /** - * Get a random weapon from a bots pool of weapons (weighted) + * Pick a random weapon based on weightings and generate a functional weapon + * @param equipmentSlot Primary/secondary/holster + * @param botTemplateInventory e.g. assault.json + * @param weaponParentId + * @param modChances + * @param botRole role of bot, e.g. assault/followerBully + * @param isPmc Is weapon generated for a pmc + * @returns GenerateWeaponResult object + */ + generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + /** + * Get a random weighted weapon from a bots pool of weapons * @param equipmentSlot Primary/secondary/holster * @param botTemplateInventory e.g. assault.json * @returns weapon tpl @@ -39,43 +54,24 @@ export declare class BotWeaponGenerator { * @param weaponTpl weapon tpl to generate (use pickWeightedWeaponTplFromPool()) * @param equipmentSlot slot to fit into, primary/secondary/holster * @param botTemplateInventory e.g. assault.json - * @param weaponParentId - * @param modChances - * @param botRole + * @param weaponParentId ParentId of the weapon being generated + * @param modChances Dictionary of item types and % chance weapon will have that mod + * @param botRole e.g. assault/exusec * @param isPmc * @returns GenerateWeaponResult object */ - generateWeaponByTpl(weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; /** - * Generate an entirely random weapon - * @param equipmentSlot Primary/secondary/holster - * @param botTemplateInventory e.g. assault.json - * @param weaponParentId - * @param modChances - * @param botRole - * @param isPmc - * @returns GenerateWeaponResult object - */ - generateRandomWeapon(equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; - /** - * Create array with weapon base as only element - * Add additional properties as required - * @param weaponTpl - * @param weaponParentId - * @param equipmentSlot - * @param weaponItemTemplate + * Create array with weapon base as only element and + * add additional properties based on weapon type + * @param weaponTpl Weapon tpl to create item with + * @param weaponParentId Weapons parent id + * @param equipmentSlot e.g. primary/secondary/holster + * @param weaponItemTemplate db template for weapon * @param botRole for durability values - * @returns + * @returns Base weapon item in array */ - constructWeaponBaseArray(weaponTpl: string, weaponParentId: string, equipmentSlot: string, weaponItemTemplate: ITemplateItem, botRole: string): Item[]; - /** - * Add compatible magazines to an inventory based on a generated weapon - * @param weaponDetails - * @param magCounts - * @param inventory - * @param botRole the bot type we're getting generating extra mags for - */ - addExtraMagazinesToInventory(weaponDetails: GenerateWeaponResult, magCounts: MinMax, inventory: PmcInventory, botRole: string): void; + protected constructWeaponBaseArray(weaponTpl: string, weaponParentId: string, equipmentSlot: string, weaponItemTemplate: ITemplateItem, botRole: string): Item[]; /** * Get the mods necessary to kit out a weapon to its preset level * @param weaponTpl weapon to find preset for @@ -84,33 +80,21 @@ export declare class BotWeaponGenerator { * @returns array of weapon mods */ protected getPresetWeaponMods(weaponTpl: string, equipmentSlot: string, weaponParentId: string, itemTemplate: ITemplateItem, botRole: string): Item[]; - /** Checks if all required slots are occupied on a weapon and all it's mods */ + /** + * Checks if all required slots are occupied on a weapon and all it's mods + * @param weaponItemArray Weapon + mods + * @returns true if valid + */ protected isWeaponValid(weaponItemArray: Item[]): boolean; /** * Generates extra magazines or bullets (if magazine is internal) and adds them to TacticalVest and Pockets. * Additionally, adds extra bullets to SecuredContainer - * @param weaponMods - * @param weaponTemplate - * @param magCounts - * @param ammoTpl - * @param inventory - * @param botRole the bot type we're getting generating extra mags for - * @returns + * @param generatedWeaponResult object with properties for generated weapon (weapon mods pool / weapon template / ammo tpl) + * @param magCounts Magazine count to add to inventory + * @param inventory Inventory to add magazines to + * @param botRole The bot type we're getting generating extra mags for */ - protected generateExtraMagazines(weaponMods: Item[], weaponTemplate: ITemplateItem, magCounts: MinMax, ammoTpl: string, inventory: PmcInventory, botRole: string): void; - /** - * Get a randomised number of bullets for a specific magazine - * @param magCounts min and max count of magazines - * @param magTemplate magazine to generate bullet count for - * @returns bullet count number - */ - protected getRandomisedBulletCount(magCounts: MinMax, magTemplate: ITemplateItem): number; - /** - * Get a randomised count of magazines - * @param magCounts min and max value returned value can be between - * @returns numberical value of magazine count - */ - protected getRandomisedMagazineCount(magCounts: MinMax): number; + addExtraMagazinesToInventory(generatedWeaponResult: GenerateWeaponResult, magCounts: MinMax, inventory: PmcInventory, botRole: string): void; /** * Add ammo to the secure container * @param stackCount How many stacks of ammo to add @@ -127,21 +111,13 @@ export declare class BotWeaponGenerator { * @returns magazine tpl string */ protected getMagazineTplFromWeaponTemplate(weaponMods: Item[], weaponTemplate: ITemplateItem, botRole: string): string; - /** - * Get a weapons default magazine template id - * @param weaponTemplate weapon to get default magazine for - * @returns tpl of magazine - */ - protected getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - protected addBulletsToVestAndPockets(ammoTpl: string, bulletCount: number, inventory: PmcInventory): void; /** * Finds and return a compatible ammo tpl based on the bots ammo weightings (x.json/inventory/equipment/ammo) * @param ammo a list of ammo tpls the weapon can use * @param weaponTemplate the weapon we want to pick ammo for - * @param isPmc is the ammo being gathered for a pmc (runs pmc ammo filtering) * @returns an ammo tpl that works with the desired gun */ - protected getCompatibleAmmo(ammo: Record>, weaponTemplate: ITemplateItem, isPmc: boolean): string; + protected getWeightedCompatibleAmmo(ammo: Record>, weaponTemplate: ITemplateItem): string; /** * Get a weapons compatible cartridge caliber * @param weaponTemplate Weapon to look up caliber of diff --git a/Live/CWX_BushWhacker/server/dist/types/generators/LocationGenerator.d.ts b/Live/CWX_BushWhacker/server/dist/types/generators/LocationGenerator.d.ts index bd368b5..cc61dcf 100644 --- a/Live/CWX_BushWhacker/server/dist/types/generators/LocationGenerator.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/generators/LocationGenerator.d.ts @@ -3,10 +3,9 @@ import { GameEventHelper } from "../helpers/GameEventHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; -import { ILooseLoot, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; +import { ILooseLoot, SpawnpointsForced, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; import { Item } from "../models/eft/common/tables/IItem"; import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticLootDetails } from "../models/eft/common/tables/ILootBase"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -36,11 +35,19 @@ export declare class LocationGenerator { generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; + /** + * Create array of loose + forced loot using probability system + * @param dynamicLootDist + * @param staticAmmoDist + * @param locationName Location to generate loot for + * @returns Array of spawn points with loot in them + */ generateDynamicLoot(dynamicLootDist: ILooseLoot, staticAmmoDist: Record, locationName: string): SpawnpointTemplate[]; + /** + * Add forced spawn point loot into loot parameter array + * @param loot array to add forced loot to + * @param forcedSpawnPoints forced loot to add + */ + protected addForcedLoot(loot: SpawnpointTemplate[], forcedSpawnPoints: SpawnpointsForced[]): void; protected createItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; - protected getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; - protected getRandomValidCaliber(magTemplate: ITemplateItem): string; - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; - protected createRandomMagCartridges(magTemplate: ITemplateItem, parentId: string, staticAmmoDist: Record, caliber?: string): Item; - protected createCartidges(parentId: string, ammoTpl: string, stackCount: number): Item; } diff --git a/Live/CWX_BushWhacker/server/dist/types/generators/LootGenerator.d.ts b/Live/CWX_BushWhacker/server/dist/types/generators/LootGenerator.d.ts new file mode 100644 index 0000000..bbc1915 --- /dev/null +++ b/Live/CWX_BushWhacker/server/dist/types/generators/LootGenerator.d.ts @@ -0,0 +1,58 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Preset } from "../models/eft/common/IGlobals"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { LootItem } from "../models/spt/services/LootItem"; +import { LootRequest } from "../models/spt/services/LootRequest"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { HashUtil } from "../utils/HashUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class LootGenerator { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected databaseServer: DatabaseServer; + protected randomUtil: RandomUtil; + protected itemHelper: ItemHelper; + protected itemFilterService: ItemFilterService; + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, itemFilterService: ItemFilterService); + /** + * Generate a list of items based on options passed in + * @param options parameters to adjust what loot is generated + * @returns An array of loot items + */ + createRandomloot(options: LootRequest): LootItem[]; + /** + * Construct item limit record to hold max and current item count + * @param limits limits as defined in config + * @returns record, key: item tplId, value: current/max item count allowed + */ + protected initItemLimitCounter(limits: Record): Record; + /** + * Find a random item in items.json and add to result array + * @param items items to choose from + * @param itemTypeCounts item limit counts + * @param options item filters + * @param result array to add found item to + * @returns true if item was valid and added to pool + */ + protected findAndAddRandomItemToLoot(items: [string, ITemplateItem][], itemTypeCounts: Record, options: LootRequest, result: LootItem[]): boolean; + /** + * + * Find a random item in items.json and add to result array + * @param globalDefaultPresets presets to choose from + * @param itemTypeCounts item limit counts + * @param result array to add found preset to + * @returns true if preset was valid and added to pool + */ + protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, Preset][], itemTypeCounts: Record, result: LootItem[]): boolean; +} diff --git a/Live/CWX_BushWhacker/server/dist/types/generators/PMCLootGenerator.d.ts b/Live/CWX_BushWhacker/server/dist/types/generators/PMCLootGenerator.d.ts index 64e6f7f..b9f2a83 100644 --- a/Live/CWX_BushWhacker/server/dist/types/generators/PMCLootGenerator.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/generators/PMCLootGenerator.d.ts @@ -1,15 +1,21 @@ import { ItemHelper } from "../helpers/ItemHelper"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ConfigServer } from "../servers/ConfigServer"; import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +/** + * Handle the generation of dynamic PMC loot in pockets and backpacks + * and the removal of blacklisted items + */ export declare class PMCLootGenerator { protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; + protected itemFilterService: ItemFilterService; protected pocketLootPool: string[]; protected backpackLootPool: string[]; protected botConfig: IBotConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService); generatePMCPocketLootPool(): string[]; generatePMCBackpackLootPool(): string[]; } diff --git a/Live/CWX_BushWhacker/server/dist/types/generators/RagfairAssortGenerator.d.ts b/Live/CWX_BushWhacker/server/dist/types/generators/RagfairAssortGenerator.d.ts index cbdd7f2..db4811d 100644 --- a/Live/CWX_BushWhacker/server/dist/types/generators/RagfairAssortGenerator.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/generators/RagfairAssortGenerator.d.ts @@ -1,5 +1,8 @@ import { ItemHelper } from "../helpers/ItemHelper"; +import { Preset } from "../models/eft/common/IGlobals"; import { Item } from "../models/eft/common/tables/IItem"; +import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -8,18 +11,40 @@ export declare class RagfairAssortGenerator { protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; protected generatedAssortItems: Item[]; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer); + protected ragfairConfig: IRagfairConfig; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); /** * Get an array of unique items that can be sold on the flea * @returns array of unique items */ getAssortItems(): Item[]; + /** + * Check internal generatedAssortItems array has objects + * @returns true if array has objects + */ protected assortsAreGenerated(): boolean; /** * Generate an array of items the flea can sell * @returns array of unique items */ protected generateRagfairAssortItems(): Item[]; + /** + * Get presets from globals.json + * @returns Preset object array + */ + protected getPresets(): Preset[]; + /** + * Get default presets from globals.json + * @returns Preset object array + */ + protected getDefaultPresets(): Preset[]; + /** + * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true + * @param tplId tplid to add to item + * @param id id to add to item + * @returns hydrated Item object + */ protected createRagfairAssortItem(tplId: string, id?: string): Item; } diff --git a/Live/CWX_BushWhacker/server/dist/types/generators/RagfairOfferGenerator.d.ts b/Live/CWX_BushWhacker/server/dist/types/generators/RagfairOfferGenerator.d.ts index 3e7f4cc..317cd6b 100644 --- a/Live/CWX_BushWhacker/server/dist/types/generators/RagfairOfferGenerator.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/generators/RagfairOfferGenerator.d.ts @@ -41,15 +41,37 @@ export declare class RagfairOfferGenerator { createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; protected getTraderId(userID: string): string; protected getRating(userID: string): number; + /** + * Is the offers user rating growing + * @param userID user to check rating of + * @returns true if its growing + */ protected getRatingGrowing(userID: string): boolean; + /** + * Get number of section until offer should expire + * @param userID Id of the offer owner + * @param time Time the offer is posted + * @returns number of seconds until offer expires + */ protected getOfferEndTime(userID: string, time: number): number; /** * Create multiple offers for items by using a unique list of items we've generated previously - * @param expiredOffers + * @param expiredOffers optional, expired offers to regenerate */ generateDynamicOffers(expiredOffers?: Item[]): void; - generateTraderOffers(traderID: string): void; + /** + * Generate trader offers on flea using the traders assort data + * @param traderID Trader to generate offers for + */ + generateFleaOffersForTrader(traderID: string): void; protected getItemCondition(userID: string, items: Item[], itemDetails: ITemplateItem): Item[]; + /** + * Add missing conditions to an item if needed + * Durabiltiy for repairable items + * HpResource for medical items + * @param item item to add conditions to + * @returns Item with conditions added + */ protected addMissingCondition(item: Item): Item; protected getOfferRequirements(items: Item[]): { count: number; @@ -57,6 +79,14 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a flea offer and store it in the Ragfair server offers array + * @param userID owner of the offer + * @param time time offer is put up + * @param items items in the offer + * @param barterScheme + * @param loyalLevel + * @param price price of offer + * @param sellInOnePiece + * @returns */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/Live/CWX_BushWhacker/server/dist/types/generators/ScavCaseRewardGenerator.d.ts b/Live/CWX_BushWhacker/server/dist/types/generators/ScavCaseRewardGenerator.d.ts index c7d6ab7..89cb5c8 100644 --- a/Live/CWX_BushWhacker/server/dist/types/generators/ScavCaseRewardGenerator.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/generators/ScavCaseRewardGenerator.d.ts @@ -8,9 +8,13 @@ import { RewardCountAndPriceDetails, ScavCaseRewardCountsAndPrices } from "../mo import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { RagfairPriceService } from "../services/RagfairPriceService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +/** + * Handle the creation of randomised scav case rewards + */ export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; @@ -18,9 +22,10 @@ export declare class ScavCaseRewardGenerator { protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param body client request diff --git a/Live/CWX_BushWhacker/server/dist/types/generators/WeatherGenerator.d.ts b/Live/CWX_BushWhacker/server/dist/types/generators/WeatherGenerator.d.ts index 44cecbb..8ddbe49 100644 --- a/Live/CWX_BushWhacker/server/dist/types/generators/WeatherGenerator.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/generators/WeatherGenerator.d.ts @@ -1,7 +1,7 @@ import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { ConfigServer } from "../servers/ConfigServer"; import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class WeatherGenerator { @@ -21,11 +21,16 @@ export declare class WeatherGenerator { protected getAcceleratedTime(computedDate: Date): string; /** * Get current time formatted to fit BSGs requirement - * @param computedDate + * @param computedDate date to format into bsg style * @returns */ protected getNormalTime(computedDate: Date): string; - generateWeather(data: IWeatherData): IWeatherData; + /** + * Return randomised Weather data + * @param weatherData weather input data + * @returns Randomised weather data + */ + generateWeather(weatherData: IWeatherData): IWeatherData; protected getWeightedFog(): string; protected getWeightedRain(): number; protected getRandomFloat(node: string): number; diff --git a/Live/CWX_BushWhacker/server/dist/types/generators/weapongen/IInventoryMagGen.d.ts b/Live/CWX_BushWhacker/server/dist/types/generators/weapongen/IInventoryMagGen.d.ts new file mode 100644 index 0000000..792f510 --- /dev/null +++ b/Live/CWX_BushWhacker/server/dist/types/generators/weapongen/IInventoryMagGen.d.ts @@ -0,0 +1,6 @@ +import { InventoryMagGen } from "./InventoryMagGen"; +export interface IInventoryMagGen { + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_BushWhacker/server/dist/types/generators/weapongen/InventoryMagGen.d.ts b/Live/CWX_BushWhacker/server/dist/types/generators/weapongen/InventoryMagGen.d.ts new file mode 100644 index 0000000..30bf79f --- /dev/null +++ b/Live/CWX_BushWhacker/server/dist/types/generators/weapongen/InventoryMagGen.d.ts @@ -0,0 +1,16 @@ +import { MinMax } from "../../models/common/MinMax"; +import { Inventory } from "../../models/eft/common/tables/IBotBase"; +import { ITemplateItem } from "../../models/eft/common/tables/ITemplateItem"; +export declare class InventoryMagGen { + private magCounts; + private magazineTemplate; + private weaponTemplate; + private ammoTemplate; + private pmcInventory; + constructor(magCounts: MinMax, magazineTemplate: ITemplateItem, weaponTemplate: ITemplateItem, ammoTemplate: ITemplateItem, pmcInventory: Inventory); + getMagCount(): MinMax; + getMagazineTemplate(): ITemplateItem; + getWeaponTemplate(): ITemplateItem; + getAmmoTemplate(): ITemplateItem; + getPmcInventory(): Inventory; +} diff --git a/Live/CWX_BushWhacker/server/dist/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts b/Live/CWX_BushWhacker/server/dist/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts new file mode 100644 index 0000000..b754d5f --- /dev/null +++ b/Live/CWX_BushWhacker/server/dist/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts @@ -0,0 +1,12 @@ +import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; +import { RandomUtil } from "../../../utils/RandomUtil"; +import { IInventoryMagGen } from "../IInventoryMagGen"; +import { InventoryMagGen } from "../InventoryMagGen"; +export declare class BarrelInventoryMagGen implements IInventoryMagGen { + protected randomUtil: RandomUtil; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + constructor(randomUtil: RandomUtil, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_BushWhacker/server/dist/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/Live/CWX_BushWhacker/server/dist/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts new file mode 100644 index 0000000..4fcb1e2 --- /dev/null +++ b/Live/CWX_BushWhacker/server/dist/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -0,0 +1,14 @@ +import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; +import { ItemHelper } from "../../../helpers/ItemHelper"; +import { ILogger } from "../../../models/spt/utils/ILogger"; +import { IInventoryMagGen } from "../IInventoryMagGen"; +import { InventoryMagGen } from "../InventoryMagGen"; +export declare class ExternalInventoryMagGen implements IInventoryMagGen { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + constructor(logger: ILogger, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_BushWhacker/server/dist/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts b/Live/CWX_BushWhacker/server/dist/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts new file mode 100644 index 0000000..4548a04 --- /dev/null +++ b/Live/CWX_BushWhacker/server/dist/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts @@ -0,0 +1,10 @@ +import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; +import { IInventoryMagGen } from "../IInventoryMagGen"; +import { InventoryMagGen } from "../InventoryMagGen"; +export declare class InternalMagazineInventoryMagGen implements IInventoryMagGen { + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + constructor(botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_BushWhacker/server/dist/types/helpers/AssortHelper.d.ts b/Live/CWX_BushWhacker/server/dist/types/helpers/AssortHelper.d.ts index 15586b9..bfc157f 100644 --- a/Live/CWX_BushWhacker/server/dist/types/helpers/AssortHelper.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/helpers/AssortHelper.d.ts @@ -17,7 +17,7 @@ export declare class AssortHelper { * @param assort assort items from a trader * @returns assort items minus locked quest assorts */ - stripLockedQuestAssort(pmcProfile: IPmcData, traderId: string, assort: ITraderAssort): ITraderAssort; + stripLockedQuestAssort(pmcProfile: IPmcData, traderId: string, assort: ITraderAssort, flea?: boolean): ITraderAssort; /** * Remove assorts from a trader that have not been unlocked yet * @param pmcProfile player profile @@ -32,5 +32,5 @@ export declare class AssortHelper { * @param itemID item id to remove from asort * @returns Modified assort */ - removeItemFromAssort(assort: ITraderAssort, itemID: string): ITraderAssort; + removeItemFromAssort(assort: ITraderAssort, itemID: string, flea?: boolean): ITraderAssort; } diff --git a/Live/CWX_BushWhacker/server/dist/types/helpers/BotGeneratorHelper.d.ts b/Live/CWX_BushWhacker/server/dist/types/helpers/BotGeneratorHelper.d.ts index 3cd7256..5e3e501 100644 --- a/Live/CWX_BushWhacker/server/dist/types/helpers/BotGeneratorHelper.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/helpers/BotGeneratorHelper.d.ts @@ -1,19 +1,33 @@ import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper"; -import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem"; -import { Grid, ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { ItemFilterService } from "../services/ItemFilterService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotWeaponGeneratorHelper } from "./BotWeaponGeneratorHelper"; import { ContainerHelper } from "./ContainerHelper"; import { InventoryHelper } from "./InventoryHelper"; import { ItemHelper } from "./ItemHelper"; import { ProbabilityHelper } from "./ProbabilityHelper"; +import { ProfileHelper } from "./ProfileHelper"; +export declare class BotModLimits { + scope: ItemCount; + scopeMax: number; + scopeBaseTypes: string[]; + flashlightLaser: ItemCount; + flashlightLaserMax: number; + flashlgihtLaserBaseTypes: string[]; +} +export declare class ItemCount { + count: number; +} export declare class BotGeneratorHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -25,16 +39,121 @@ export declare class BotGeneratorHelper { protected itemHelper: ItemHelper; protected inventoryHelper: InventoryHelper; protected containerHelper: ContainerHelper; + protected botEquipmentFilterService: BotEquipmentFilterService; + protected itemFilterService: ItemFilterService; + protected profileHelper: ProfileHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, configServer: ConfigServer); - generateModsForItem(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, configServer: ConfigServer); /** - * Is this magazine cylinder related (revolvers and grenade launchers) - * @param magazineParentName the name of the magazines parent - * @returns true if it is cylinder related + * Check mods are compatible and add to array + * @param equipment Equipment item to add mods to + * @param modPool Mod list to choose frm + * @param parentId parentid of item to add mod to + * @param parentTemplate template objet of item to add mods to + * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @returns Item + compatible mods as an array */ - magazineIsCylinderRelated(magazineParentName: string): boolean; + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + /** + * @param sessionId session id + * @param weapon Weapon to add mods to + * @param modPool Pool of compatible mods to attach to weapon + * @param weaponParentId parentId of weapon + * @param parentWeaponTemplate Weapon which mods will be generated on + * @param modSpawnChances Mod spawn chances + * @param ammoTpl Ammo tpl to use when generating magazines/cartridges + * @param botRole Role of bot weapon is generated for + * @returns Weapon + mods array + */ + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; + /** + * + * @param modSlot + * @param isRandomisableSlot + * @param modsParent + * @param botEquipBlacklist + * @param itemModPool + * @param weapon array with only weapon tpl in it, ready for mods to be added + * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) + * @param parentTemplate + * @returns + */ + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + /** + * Find mod tpls of a provided type and add to modPool + * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) + * @param modTemplate db object for modItem we get compatible mods from + * @param modPool Pool of mods we are adding to + */ + protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; + /** + * Check if mod item is on limited list + has surpassed the limit set for it + * @param botRole role the bot has e.g. assault + * @param modTemplate mods template data + * @param modLimits limits set for weapon being generated for this bot + * @returns true if over item limit + */ + protected modHasReachedItemLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits): boolean; + /** + * Initalise mod limits to be used when generating a weapon + * @param botRole "assault", "bossTagilla" or "pmc" + * @returns BotModLimits object + */ + protected initModLimits(botRole: string): BotModLimits; + /** + * Generate a pool of mods for this bots mod type if bot has values inside `randomisedWeaponModSlots` array found in bot.json/equipment[botrole] + * @param allowedMods Mods to be added to mod pool + * @param botEquipBlacklist blacklist of items not allowed to be added to mod pool + * @param modSlot Slot to generate mods for + * @param itemModPool base mod pool to replace values of + */ + protected generateDynamicWeaponModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record): void; + /** + * Find all compatible mods for equipment item and add to modPool + * @param itemDetails item to find mods for + * @param modPool ModPool to add mods to + */ + generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods): void; + /** + * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist + * @param allowedMods base mods to filter + * @param botEquipBlacklist equipment blacklist + * @param modSlot slot mods belong to + * @returns Filtered array of mod tpls + */ + protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; + /** + * Check if the specific item type on the weapon has reached the set limit + * @param modTpl log mod tpl if over type limit + * @param currentCount current number of this item on gun + * @param maxLimit mod limit allowed + * @param botRole role of bot we're checking weapon of + * @returns true if limit reached + */ + protected weaponModLimitReached(modTpl: string, currentCount: { + count: number; + }, maxLimit: number, botRole: string): boolean; + /** + * Log errors if mod is not compatible with slot + * @param modToAdd template of mod to check + * @param itemSlot slot the item will be placed in + * @param modSlot slot the mod will fill + * @param parentTemplate tempalte of the mods parent item + * @returns true if valid + */ + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + /** + * Create a mod item with parameters as properties + * @param modId _id + * @param modTpl _tpl + * @param parentId parentId + * @param modSlot slotId + * @param modTemplate Used to add additional properites in the upd object + * @returns Item object + */ + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem): Item; /** * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance @@ -46,7 +165,7 @@ export declare class BotGeneratorHelper { protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; /** * Get a list of containers that hold ammo - * e.g. mod_magazine + * e.g. mod_magazine / patron_in_weapon_000 * @returns string array */ protected getAmmoContainers(): string[]; @@ -62,11 +181,11 @@ export declare class BotGeneratorHelper { * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" - * - * @param {object} items The items where the CylinderMagazine's camora are appended to - * @param {object} modPool modPool which should include available cartrigdes - * @param {string} parentId The CylinderMagazine's UID - * @param {object} parentTemplate The CylinderMagazine's template + * @param items The items where the CylinderMagazine's camora are appended to + * @param modPool modPool which should include available cartrigdes + * @param parentId The CylinderMagazine's UID + * @param parentTemplate The CylinderMagazine's template + * @returns */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** @@ -75,6 +194,13 @@ export declare class BotGeneratorHelper { * @returns string array of shells fro luitple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + /** + * Adds properties to an item + * e.g. Repairable / HasHinge / Foldable / MaxDurability + * @param itemTemplate + * @param botRole Used by weapons to randomise the durability values + * @returns Item Upd object with extra properties + */ generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { upd?: Upd; }; @@ -92,13 +218,15 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; - protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** - * Sort by spawn chance, highest to lowest, higher is more common - * @param unsortedModArray String array to sort - * @returns Sorted string array + * Get a random mod from an items compatible mods Filter array + * @param modTpl + * @param parentSlot + * @param modSlot + * @param items + * @returns item tpl */ - protected sortModArray(unsortedModArray: string[]): string[]; + protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** * Can an item be added to an item without issue * @param items @@ -107,18 +235,8 @@ export declare class BotGeneratorHelper { * @returns true if possible */ isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; - /** - * Adds an item with all its childern into specified equipmentSlots, wherever it fits. - * @param equipmentSlots - * @param parentId - * @param parentTpl - * @param itemWithChildren - * @param inventory - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: PmcInventory): boolean; - protected itemAllowedInContainer(slot: Grid, itemTpl: string): boolean; } +/** TODO - move into own class */ export declare class ExhaustableArray { private itemPool; private randomUtil; diff --git a/Live/CWX_BushWhacker/server/dist/types/helpers/BotHelper.d.ts b/Live/CWX_BushWhacker/server/dist/types/helpers/BotHelper.d.ts index 9b89481..18738e5 100644 --- a/Live/CWX_BushWhacker/server/dist/types/helpers/BotHelper.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/helpers/BotHelper.d.ts @@ -13,11 +13,34 @@ export declare class BotHelper { protected configServer: ConfigServer; protected botConfig: IBotConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, configServer: ConfigServer); + /** + * Get difficulty settings for desired bot type, if not found use assault bot types + * @param type bot type to retreive difficulty of + * @param difficulty difficulty to get settings for (easy/normal etc) + * @returns Difficulty object + */ getBotDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Get a template object for the specified botRole from bots.types db + * @param role botRole to get template for + * @returns IBotType object + */ getBotTemplate(role: string): IBotType; + /** + * Get difficulty settings for a PMC + * @param type "usec" / "bear" + * @param difficulty what difficulty to retrieve + * @returns Difficulty object + */ getPmcDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Choose a random difficulty from - easy/normal/hard/impossible + * @returns random difficulty + */ + chooseRandomDifficulty(): string; /** * Randomise the chance the PMC will attack their own side + * Look up value in bot.json/chanceSameSideIsHostilePercent * @param difficultySettings pmc difficulty settings */ randomisePmcHostility(difficultySettings: Difficulty): void; @@ -31,7 +54,7 @@ export declare class BotHelper { */ addBotToFriendlyList(difficultySettings: Difficulty, typeToAdd: string): void; /** - * Add a bot to the ENEMY_BOT_TYPES array + * Add a bot to the ENEMY_BOT_TYPES array, do not add itself if its on the enemy list * @param difficultySettings bot settings to alter * @param typesToAdd bot type to add to enemy list */ @@ -42,4 +65,10 @@ export declare class BotHelper { * @param typesToAdd bot type to add to revenge list */ addBotToRevengeList(difficultySettings: Difficulty, typesToAdd: string[]): void; + /** + * Choose if a bot should become a PMC by checking if bot type is allowed to become a Pmc in botConfig.convertFromChances and doing a random int check + * @param botRole the bot role to check if should be a pmc + * @returns true if should be a pmc + */ + shouldBotBePmc(botRole: string): boolean; } diff --git a/Live/CWX_BushWhacker/server/dist/types/helpers/BotWeaponGeneratorHelper.d.ts b/Live/CWX_BushWhacker/server/dist/types/helpers/BotWeaponGeneratorHelper.d.ts new file mode 100644 index 0000000..7e25f56 --- /dev/null +++ b/Live/CWX_BushWhacker/server/dist/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -0,0 +1,78 @@ +import { MinMax } from "../models/common/MinMax"; +import { Inventory } from "../models/eft/common/tables/IBotBase"; +import { Item } from "../models/eft/common/tables/IItem"; +import { Grid, ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { HashUtil } from "../utils/HashUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { ContainerHelper } from "./ContainerHelper"; +import { InventoryHelper } from "./InventoryHelper"; +import { ItemHelper } from "./ItemHelper"; +export declare class BotWeaponGeneratorHelper { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper); + /** + * Get a randomised number of bullets for a specific magazine + * @param magCounts min and max count of magazines + * @param magTemplate magazine to generate bullet count for + * @returns bullet count number + */ + getRandomisedBulletCount(magCounts: MinMax, magTemplate: ITemplateItem): number; + /** + * Get a randomised count of magazines + * @param magCounts min and max value returned value can be between + * @returns numberical value of magazine count + */ + getRandomisedMagazineCount(magCounts: MinMax): number; + /** + * Is this magazine cylinder related (revolvers and grenade launchers) + * @param magazineParentName the name of the magazines parent + * @returns true if it is cylinder related + */ + magazineIsCylinderRelated(magazineParentName: string): boolean; + /** + * Create a magazine using the parameters given + * @param magazineTpl Tpl of the magazine to create + * @param ammoTpl Ammo to add to magazine + * @param magTemplate template object of magazine + * @returns Item array + */ + createMagazine(magazineTpl: string, ammoTpl: string, magTemplate: ITemplateItem): Item[]; + /** + * Add a specific number of cartrdiges to a bots inventory (vest/pocket) + * @param ammoTpl Ammo tpl to add to vest/pockets + * @param cartridgeCount number of cartridges to add to vest/pockets + * @param inventory bot inventory to add cartridges to + */ + addBulletsToVestAndPockets(ammoTpl: string, cartridgeCount: number, inventory: Inventory): void; + /** + * Get a weapons default magazine template id + * @param weaponTemplate weapon to get default magazine for + * @returns tpl of magazine + */ + getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; + /** + * Adds an item with all its childern into specified equipmentSlots, wherever it fits. + * @param equipmentSlots + * @param parentId + * @param parentTpl + * @param itemWithChildren + * @param inventory + * @returns a `boolean` indicating item was added + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): boolean; + /** + * is the provided item allowed inside a container + * @param slot location item wants to be placed in + * @param itemTpl item being placed + * @returns true if allowed + */ + protected itemAllowedInContainer(slot: Grid, itemTpl: string): boolean; +} diff --git a/Live/CWX_BushWhacker/server/dist/types/helpers/HideoutHelper.d.ts b/Live/CWX_BushWhacker/server/dist/types/helpers/HideoutHelper.d.ts index 36e4009..7495a6a 100644 --- a/Live/CWX_BushWhacker/server/dist/types/helpers/HideoutHelper.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/helpers/HideoutHelper.d.ts @@ -44,14 +44,72 @@ export declare class HideoutHelper { initProduction(recipeId: string, productionTime: number): Production; isProductionType(productive: Productive): productive is Production; applyPlayerUpgradesBonuses(pmcData: IPmcData, bonus: StageBonus): void; + /** + * TODO: + * After looking at the skills there doesnt seem to be a configuration per skill to boost + * the XP gain PER skill. I THINK you should be able to put the variable "SkillProgress" (just like health has it) + * and be able to tune the skill gain PER skill, but I havent tested it and Im not sure! + * @param pmcData + * @param bonus + */ protected applySkillXPBoost(pmcData: IPmcData, bonus: StageBonus): void; + /** + * Process a players hideout, update areas that use resources + increment production timers + * @param sessionID Session id + */ updatePlayerHideout(sessionID: string): void; + /** + * Update progress timer for water collector + * @param pmcData profile to update + * @param productionId id of water collection production to update + * @param hideoutProperties Hideout properties + */ + protected updateWaterCollectorProductionTimer(pmcData: IPmcData, productionId: string, hideoutProperties: { + btcFarmCGs?: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Update progress timer for scav case + * @param pmcData Profile to update + * @param productionId Id of scav case production to update + */ + protected updateScavCaseProductionTimer(pmcData: IPmcData, productionId: string): void; + /** + * Iterate over hideout areas that use resources (fuel/filters etc) and update associated values + * @param sessionID Session id + * @param pmcData Profile to update areas of + * @param hideoutProperties hideout properties + */ + protected updateAreasWithResources(sessionID: string, pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): HideoutArea; - protected updateWaterFilters(waterFilterArea: HideoutArea, pwProd: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; + /** + * Adjust water filter objects resourceValue or delete when they reach 0 resource + * @param waterFilterArea water filter area to update + * @param production production object + * @param isGeneratorOn is generatory enabled + * @param pmcData Player profile + * @returns Updated HideoutArea object + */ + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): HideoutArea; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; protected getBTCSlots(pmcData: IPmcData): number; protected getManagementSkillsSlots(): number; diff --git a/Live/CWX_BushWhacker/server/dist/types/helpers/InRaidHelper.d.ts b/Live/CWX_BushWhacker/server/dist/types/helpers/InRaidHelper.d.ts index c3cbfbb..962df38 100644 --- a/Live/CWX_BushWhacker/server/dist/types/helpers/InRaidHelper.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -15,19 +16,8 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); - /** - * Reset the SPT inraid property stored in a profile to 'none' - * @param sessionID Session id - */ - protected removePlayer(sessionID: string): void; - /** - * Some maps have one-time-use keys (e.g. Labs - * Remove the relevant key from an inventory based on the post-raid request data passed in - * @param offraidData post-raid data - * @param sessionID Session id - */ - protected removeMapAccessKey(offraidData: ISaveProgressRequestData, sessionID: string): void; + protected profileFixerService: ProfileFixerService; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); /** * Check an array of items and add an upd object to money items with a stack count of 1 * Single stack money items have no upd object and thus no StackObjectsCount, causing issues @@ -52,6 +42,18 @@ export declare class InRaidHelper { * @returns Reset profile object */ updateProfileBaseStats(profileData: IPmcData, saveProgressRequest: ISaveProgressRequestData, sessionID: string): IPmcData; + /** + * Some maps have one-time-use keys (e.g. Labs + * Remove the relevant key from an inventory based on the post-raid request data passed in + * @param offraidData post-raid data + * @param sessionID Session id + */ + protected removeMapAccessKey(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Set the SPT inraid location Profile property to 'none' + * @param sessionID Session id + */ + protected setPlayerInRaidLocationStatusToNone(sessionID: string): void; /** * Adds SpawnedInSession property to items found in a raid * Removes SpawnedInSession for non-scav players if item was taken into raid with SpawnedInSession = true @@ -93,5 +95,10 @@ export declare class InRaidHelper { * @returns true if item is kept after death */ isItemKeptAfterDeath(slotId: string): boolean; + /** + * Return the equipped items from a players inventory + * @param items Players inventory to search through + * @returns an array of equipped items + */ getPlayerGear(items: Item[]): Item[]; } diff --git a/Live/CWX_BushWhacker/server/dist/types/helpers/InventoryHelper.d.ts b/Live/CWX_BushWhacker/server/dist/types/helpers/InventoryHelper.d.ts index dc7cbca..b8e5c9d 100644 --- a/Live/CWX_BushWhacker/server/dist/types/helpers/InventoryHelper.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/helpers/InventoryHelper.d.ts @@ -43,6 +43,7 @@ export declare class InventoryHelper { constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; diff --git a/Live/CWX_BushWhacker/server/dist/types/helpers/ItemHelper.d.ts b/Live/CWX_BushWhacker/server/dist/types/helpers/ItemHelper.d.ts index 1701c62..0effaf2 100644 --- a/Live/CWX_BushWhacker/server/dist/types/helpers/ItemHelper.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/helpers/ItemHelper.d.ts @@ -1,35 +1,30 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { InsuredItem } from "../models/eft/common/tables/IBotBase"; import { Item, Repairable } from "../models/eft/common/tables/IItem"; +import { IStaticAmmoDetails } from "../models/eft/common/tables/ILootBase"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ObjectId } from "../utils/ObjectId"; +import { RandomUtil } from "../utils/RandomUtil"; declare class ItemHelper { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected randomUtil: RandomUtil; + protected objectId: ObjectId; + protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer); /** - * Checks if a id is a valid item. Valid meaning that it's an item that be stored in stash + * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl * @returns boolean; true for items that may be in player posession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {*} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - isValidRewardItem(tpl: string): boolean; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - getRewardableItems(): [string, ITemplateItem][]; /** * Check if the tpl / template Id provided is a descendent of the baseclass * @@ -84,6 +79,11 @@ declare class ItemHelper { * @returns {array} The array of StackSlotItems */ generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; + /** + * Get cloned copy of all item data from items.json + * @returns array of ITemplateItem objects + */ + getItems(): ITemplateItem[]; /** * Gets item data from items.json * @param tpl items template id to look up @@ -196,6 +196,22 @@ declare class ItemHelper { * @returns ItemSize object (width and height) */ getItemSize(items: Item[], rootItemId: string): ItemHelper.ItemSize; + /** + * Get a random cartridge from an items Filter property + * @param item + * @returns + */ + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + createRandomMagCartridges(magTemplate: ITemplateItem, parentId: string, staticAmmoDist: Record, caliber?: string): Item; + protected getRandomValidCaliber(magTemplate: ITemplateItem): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + createCartidges(parentId: string, ammoTpl: string, stackCount: number): Item; + /** + * Get the size of a stack, return 1 if no stack object count property found + * @param item Item to get stack size of + * @returns size of stack + */ + getItemStackSize(item: Item): number; } declare namespace ItemHelper { interface ItemSize { diff --git a/Live/CWX_BushWhacker/server/dist/types/helpers/ProfileHelper.d.ts b/Live/CWX_BushWhacker/server/dist/types/helpers/ProfileHelper.d.ts index 6c150c8..9c6560a 100644 --- a/Live/CWX_BushWhacker/server/dist/types/helpers/ProfileHelper.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/helpers/ProfileHelper.d.ts @@ -2,24 +2,41 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Stats } from "../models/eft/common/tables/IBotBase"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; +import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { ItemHelper } from "./ItemHelper"; export declare class ProfileHelper { + protected logger: ILogger; protected jsonUtil: JsonUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected profileSnapshotService: ProfileSnapshotService; protected fenceService: FenceService; - constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; getCompleteProfile(sessionID: string): IPmcData[]; + /** + * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen + * Server saves the post-raid changes prior to the xp screen getting the profile, this results in the xp screen using + * the now updated profile values as a base, meaning it shows x2 xp gained + * Instead, clone the post-raid profile (so we dont alter its values), apply the pre-raid xp values to the cloned objects and return + * Delete snapshot of pre-raid profile prior to returning profile data + * @param sessionId Session id + * @param output pmc and scav profiles array + * @param pmcProfile post-raid pmc profile + * @param scavProfile post-raid scav profile + * @returns updated profile array + */ + protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; /** * Add experience to a PMC inside the players profile diff --git a/Live/CWX_BushWhacker/server/dist/types/helpers/QuestHelper.d.ts b/Live/CWX_BushWhacker/server/dist/types/helpers/QuestHelper.d.ts index 0f68cd5..d66d150 100644 --- a/Live/CWX_BushWhacker/server/dist/types/helpers/QuestHelper.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/helpers/QuestHelper.d.ts @@ -36,13 +36,30 @@ export declare class QuestHelper { protected configServer: ConfigServer; protected questConfig: IQuestConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); - questStatus(pmcData: IPmcData, questID: string): QuestStatus; /** - * returns true is the condition is satisfied + * Get status of a quest by quest id + * @param pmcData Profile to search + * @param questID Quest id to look up + * @returns QuestStauts enum + */ + getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus; + /** + * returns true is the level condition is satisfied + * @param playerLevel Players level + * @param condition Quest condition + * @returns true if player level is greater than or equal to quest */ - evaluateLevel(pmcProfile: IPmcData, cond: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; - rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progress: number): void; + /** + * Increase skill points of a skill on player profile + * @param sessionID Session id + * @param pmcData Player profile + * @param output output object to send back to client + * @param skillName Name of skill to increase skill points of + * @param progressAmount Amount of skill points to add to skill + */ + rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; getQuestLocale(questId: string): any; /** * Debug Routine for showing some information on the diff --git a/Live/CWX_BushWhacker/server/dist/types/helpers/RagfairOfferHelper.d.ts b/Live/CWX_BushWhacker/server/dist/types/helpers/RagfairOfferHelper.d.ts index 8d03bee..e9d72ca 100644 --- a/Live/CWX_BushWhacker/server/dist/types/helpers/RagfairOfferHelper.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/helpers/RagfairOfferHelper.d.ts @@ -22,12 +22,14 @@ import { ProfileHelper } from "./ProfileHelper"; import { RagfairHelper } from "./RagfairHelper"; import { RagfairServerHelper } from "./RagfairServerHelper"; import { RagfairSortHelper } from "./RagfairSortHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class RagfairOfferHelper { protected logger: ILogger; protected timeUtil: TimeUtil; protected hashUtil: HashUtil; protected itemEventRouter: ItemEventRouter; protected databaseServer: DatabaseServer; + protected traderHelper: TraderHelper; protected saveServer: SaveServer; protected dialogueHelper: DialogueHelper; protected itemHelper: ItemHelper; @@ -43,10 +45,10 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; - processOffers(sessionID: string): boolean; + processOffersOnProfile(sessionID: string): boolean; protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; diff --git a/Live/CWX_BushWhacker/server/dist/types/helpers/RagfairSellHelper.d.ts b/Live/CWX_BushWhacker/server/dist/types/helpers/RagfairSellHelper.d.ts index 6ec004a..91b8a20 100644 --- a/Live/CWX_BushWhacker/server/dist/types/helpers/RagfairSellHelper.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/helpers/RagfairSellHelper.d.ts @@ -11,6 +11,12 @@ export declare class RagfairSellHelper { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateSellChance(baseChance: number, offerPrice: number, requirementsPriceInRub: number): number; - rollForSale(sellChance: number, count: number): SellResult[]; + calculateSellChance(baseChancePercent: number, offerPriceRub: number, playerListedPriceRub: number): number; + /** + * Determine if the offer being listed will be sold + * @param sellChancePercent chance item will sell + * @param itemSellCount count of items to sell + * @returns Array of purchases of item(s) lsited + */ + rollForSale(sellChancePercent: number, itemSellCount: number): SellResult[]; } diff --git a/Live/CWX_BushWhacker/server/dist/types/helpers/RagfairServerHelper.d.ts b/Live/CWX_BushWhacker/server/dist/types/helpers/RagfairServerHelper.d.ts index e4939d1..a03cdda 100644 --- a/Live/CWX_BushWhacker/server/dist/types/helpers/RagfairServerHelper.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/helpers/RagfairServerHelper.d.ts @@ -6,6 +6,7 @@ import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -13,6 +14,9 @@ import { RandomUtil } from "../utils/RandomUtil"; import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { ProfileHelper } from "./ProfileHelper"; +/** + * Helper class for common ragfair server actions + */ export declare class RagfairServerHelper { protected randomUtil: RandomUtil; protected hashUtil: HashUtil; @@ -23,11 +27,12 @@ export declare class RagfairServerHelper { protected localeService: LocaleService; protected dialogueHelper: DialogueHelper; protected jsonUtil: JsonUtil; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; protected static goodsReturnedTemplate: string; - constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); + constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Is item valid / on blacklist / quest item * @param itemDetails diff --git a/Live/CWX_BushWhacker/server/dist/types/helpers/RepairHelper.d.ts b/Live/CWX_BushWhacker/server/dist/types/helpers/RepairHelper.d.ts index 9a3ab29..5b09320 100644 --- a/Live/CWX_BushWhacker/server/dist/types/helpers/RepairHelper.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/helpers/RepairHelper.d.ts @@ -14,8 +14,17 @@ export declare class RepairHelper { protected configServer: ConfigServer; protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); - updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit?: boolean, applyRandomDegradation?: boolean): Item; - protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number): number; - protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, armorMax: number): number; + /** + * + * @param itemToRepair item to update durability details + * @param itemToRepairDetails db details of item to repair + * @param isArmor Is item being repaired a piece of armor + * @param amountToRepair how many unit of durability to repair + * @param useRepairKit Is item being repaired with a repair kit + * @param applyMaxDurabilityDegradation should item have max durability reduced + */ + updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit: boolean, traderQualityMultipler: number, applyMaxDurabilityDegradation?: boolean): void; + protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number, traderQualityMultipler: number): number; + protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, weaponMax: number, traderQualityMultipler: number): number; isWeaponTemplate(tpl: string): boolean; } diff --git a/Live/CWX_BushWhacker/server/dist/types/helpers/TradeHelper.d.ts b/Live/CWX_BushWhacker/server/dist/types/helpers/TradeHelper.d.ts index 975062b..7ab9768 100644 --- a/Live/CWX_BushWhacker/server/dist/types/helpers/TradeHelper.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/helpers/TradeHelper.d.ts @@ -39,6 +39,12 @@ export declare class TradeHelper { * @returns */ sellItem(pmcData: IPmcData, body: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Increment the assorts buy count by number of items purchased + * Show error on screen if player attepts 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; protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/Live/CWX_BushWhacker/server/dist/types/helpers/TraderAssortHelper.d.ts b/Live/CWX_BushWhacker/server/dist/types/helpers/TraderAssortHelper.d.ts index 91ba6b9..025efd6 100644 --- a/Live/CWX_BushWhacker/server/dist/types/helpers/TraderAssortHelper.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/helpers/TraderAssortHelper.d.ts @@ -1,7 +1,7 @@ import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator"; import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; import { Item } from "../models/eft/common/tables/IItem"; -import { ITraderAssort } from "../models/eft/common/tables/ITrader"; +import { ITrader, ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -10,13 +10,16 @@ import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; +import { TimeUtil } from "../utils/TimeUtil"; import { AssortHelper } from "./AssortHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class TraderAssortHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; protected mathUtil: MathUtil; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected assortHelper: AssortHelper; @@ -24,18 +27,32 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts + * Filter out assorts not unlocked due to level OR quest completion * @param sessionId session id - * @param traderId trader id - * @returns a traders assorts + * @param traderId traders id + * @returns a traders' assorts */ - getAssort(sessionId: string, traderId: string): ITraderAssort; + getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset a traders assorts and move nextResupply value to future + * Flag trader as needing a flea offer reset to be picked up by flea update() function + * @param trader trader details to alter + */ + resetExpiredTrader(trader: ITrader): void; + /** + * Does the supplied trader need its assorts refreshed + * @param traderID Trader to check + * @returns true they need refreshing + */ + traderAssortsHaveExpired(traderID: string): boolean; /** * Iterate over all assorts barter_scheme values, find barters selling for money and multiply by multipler in config * @param traderAssort Assorts to multiple price of diff --git a/Live/CWX_BushWhacker/server/dist/types/helpers/TraderHelper.d.ts b/Live/CWX_BushWhacker/server/dist/types/helpers/TraderHelper.d.ts index b2e9d38..0dc93e8 100644 --- a/Live/CWX_BushWhacker/server/dist/types/helpers/TraderHelper.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/helpers/TraderHelper.d.ts @@ -9,6 +9,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { PlayerService } from "../services/PlayerService"; +import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -23,9 +24,10 @@ export declare class TraderHelper { protected handbookHelper: HandbookHelper; protected playerService: PlayerService; protected fenceService: FenceService; + protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -63,7 +65,7 @@ export declare class TraderHelper { * @param item * @returns boolean */ - protected isWeaponAndBelowTraderBuyDurability(traderID: string, item: Item): boolean; + protected isWeaponBelowTraderBuyDurability(traderID: string, item: Item): boolean; /** * Get the price of an item and all of its attached children * Take into account bonuses/adjsutments e.g. discounts @@ -97,6 +99,17 @@ export declare class TraderHelper { * @param sessionID session id */ lvlUp(traderID: string, sessionID: string): void; + /** + * Get the next update timestamp for a trader + * @param traderID Trader to look up update value for + * @returns future timestamp + */ + getNextUpdateTimestamp(traderID: string): number; + /** + * Get the reset time between trader assort refreshes in seconds + * @param traderId Trader to look up + * @returns Time in seconds + */ getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader diff --git a/Live/CWX_BushWhacker/server/dist/types/loaders/PreAkiModLoader.d.ts b/Live/CWX_BushWhacker/server/dist/types/loaders/PreAkiModLoader.d.ts index 6ded3c6..4ab1689 100644 --- a/Live/CWX_BushWhacker/server/dist/types/loaders/PreAkiModLoader.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/loaders/PreAkiModLoader.d.ts @@ -33,9 +33,20 @@ export declare class PreAkiModLoader implements IModLoader { protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; /** - * - * @param mods Get an array of broken/invalid mods by name - * @returns Mod names array + * Check for duplciate mods loaded, show error if duplicate mod found + * @param modPackageData dictionary of mod package.json data + */ + protected checkForDuplicateMods(modPackageData: Record): void; + /** + * Check for and return duplicate strings inside an array + * @param stringArray Array to check for duplicates + * @returns string array of duplicates, empty if none found + */ + protected getDuplicates(stringArray: string[]): string[]; + /** + * Get an array of mods with errors that prevent them from working with SPT + * @param mods mods to validate + * @returns Mod names as array */ protected getBrokenMods(mods: string[]): string[]; /** @@ -57,7 +68,12 @@ export declare class PreAkiModLoader implements IModLoader { protected addMod(mod: string): Promise; protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record): boolean; protected isModCompatible(mod: IPackageJsonData, loadedMods: Record): boolean; - protected validMod(mod: string): boolean; + /** + * Validate a mod passes a number of checks + * @param modName name of mod in /mods/ to validate + * @returns true if valid + */ + protected validMod(modName: string): boolean; protected getLoadOrderRecursive(mod: string, result: Record, visited: Record): void; protected getLoadOrder(mods: Record): Record; getContainer(): DependencyContainer; diff --git a/Live/CWX_BushWhacker/server/dist/types/models/eft/common/IGlobals.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/eft/common/IGlobals.d.ts index 9d28dbc..81e2023 100644 --- a/Live/CWX_BushWhacker/server/dist/types/models/eft/common/IGlobals.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/models/eft/common/IGlobals.d.ts @@ -1175,5 +1175,6 @@ export interface Preset { _name: string; _parent: string; _items: Item[]; + /** Default presets have this property */ _encyclopedia?: string; } diff --git a/Live/CWX_BushWhacker/server/dist/types/models/eft/common/ILocationBase.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/eft/common/ILocationBase.d.ts index b1dd448..78ade9a 100644 --- a/Live/CWX_BushWhacker/server/dist/types/models/eft/common/ILocationBase.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/models/eft/common/ILocationBase.d.ts @@ -137,7 +137,7 @@ export interface BotLocationModifier { VisibleDistance: number; } export interface MinMaxBot { - WildSpawnType: string; + WildSpawnType: WildSpawnType; max: number; min: number; } @@ -195,7 +195,7 @@ export interface Wave { BotPreset: string; BotSide: string; SpawnPoints: string; - WildSpawnType: string; + WildSpawnType: WildSpawnType; isPlayers: boolean; number: number; slots_max: number; @@ -203,3 +203,7 @@ export interface Wave { time_max: number; time_min: number; } +export declare enum WildSpawnType { + ASSAULT = "assault", + MARKSMAN = "marksman" +} diff --git a/Live/CWX_BushWhacker/server/dist/types/models/eft/common/tables/IBotBase.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/eft/common/tables/IBotBase.d.ts index 0ee468e..25cb861 100644 --- a/Live/CWX_BushWhacker/server/dist/types/models/eft/common/tables/IBotBase.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/models/eft/common/tables/IBotBase.d.ts @@ -28,6 +28,8 @@ export interface IBotBase { CarExtractCounts: CarExtractCounts; SurvivorClass: SurvivorClass; WishList: string[]; + /** SPT specific property used during bot generation in raid */ + sptIsPmc?: boolean; } export interface Info { EntryPoint: string; @@ -66,13 +68,13 @@ export interface IBan { dateTime: number; } export declare enum BanType { - Chat = 0, - RagFair = 1, - Voip = 2, - Trading = 3, - Online = 4, - Friends = 5, - ChangeNickname = 6 + CHAT = 0, + RAGFAIR = 1, + VOIP = 2, + TRADING = 3, + ONLINE = 4, + FRIENDS = 5, + CHANGE_NICKNAME = 6 } export interface Customization { Head: string; @@ -312,11 +314,11 @@ export interface Notes { export interface CarExtractCounts { } export declare enum SurvivorClass { - Unknown = 0, - Neutralizer = 1, - Marauder = 2, - Paramedic = 3, - Survivor = 4 + UNKNOWN = 0, + NEUTRALIZER = 1, + MARAUDER = 2, + PARAMEDIC = 3, + SURVIVOR = 4 } export interface Quest { qid: string; diff --git a/Live/CWX_BushWhacker/server/dist/types/models/eft/common/tables/ITemplateItem.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/eft/common/tables/ITemplateItem.d.ts index 23a1a14..8569e61 100644 --- a/Live/CWX_BushWhacker/server/dist/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/models/eft/common/tables/ITemplateItem.d.ts @@ -34,6 +34,7 @@ export interface Props { LootExperience?: number; ExamineExperience?: number; HideEntrails?: boolean; + InsuranceDisabled?: boolean; RepairCost?: number; RepairSpeed?: number; ExtraSizeLeft?: number; @@ -79,7 +80,7 @@ export interface Props { HasShoulderContact?: boolean; SightingRange?: number; DoubleActionAccuracyPenaltyMult?: number; - ModesCount: any; + ModesCount?: any; DurabilityBurnModificator?: number; HeatFactor?: number; CoolFactor?: number; @@ -155,7 +156,7 @@ export interface Props { RigLayoutName?: string; MaxDurability?: number; armorZone?: string[]; - armorClass: any; + armorClass?: any; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -206,6 +207,7 @@ export interface Props { IsOneoff?: boolean; MustBoltBeOpennedForExternalReload?: boolean; MustBoltBeOpennedForInternalReload?: boolean; + NoFiremodeOnBoltcatch?: boolean; BoltAction?: boolean; HipAccuracyRestorationDelay?: number; HipAccuracyRestorationSpeed?: number; @@ -252,8 +254,8 @@ export interface Props { foodUseTime?: number; foodEffectType?: string; StimulatorBuffs?: string; - effects_health: any; - effects_damage: any; + effects_health?: any; + effects_damage?: any; MaximumNumberOfUsage?: number; knifeHitDelay?: number; knifeHitSlashRate?: number; diff --git a/Live/CWX_BushWhacker/server/dist/types/models/eft/common/tables/ITrader.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/eft/common/tables/ITrader.d.ts index f0fe2b5..37b2d61 100644 --- a/Live/CWX_BushWhacker/server/dist/types/models/eft/common/tables/ITrader.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/models/eft/common/tables/ITrader.d.ts @@ -7,7 +7,7 @@ export interface ITrader { suits?: ISuit[]; } export interface ITraderBase { - refreshAssort: boolean; + refreshTraderRagfairOffers: boolean; _id: string; avatar: string; balance_dol: number; @@ -58,7 +58,7 @@ export interface Repair { quality: string; } export interface ITraderAssort { - nextResupply?: number; + nextResupply: number; items: Item[]; barter_scheme: Record; loyal_level_items: Record; @@ -67,6 +67,7 @@ export interface IBarterScheme { count: number; _tpl: string; onlyFunctional?: boolean; + sptQuestLocked?: boolean; } export interface ISuit { _id: string; diff --git a/Live/CWX_BushWhacker/server/dist/types/models/eft/health/Effect.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/eft/health/Effect.d.ts index 2f0adac..7eb3ffc 100644 --- a/Live/CWX_BushWhacker/server/dist/types/models/eft/health/Effect.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/models/eft/health/Effect.d.ts @@ -1,5 +1,5 @@ export declare enum Effect { - Fracture = "Fracture", - LightBleeding = "LightBleeding", - HeavyBleeding = "HeavyBleeding" + FRACTURE = "Fracture", + LIGHT_BLEEDING = "LightBleeding", + HEAVY_BLEEDING = "HeavyBleeding" } diff --git a/Live/CWX_BushWhacker/server/dist/types/models/eft/health/IOffraidHealRequestData.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/eft/health/IOffraidHealRequestData.d.ts index c242300..26b02bd 100644 --- a/Live/CWX_BushWhacker/server/dist/types/models/eft/health/IOffraidHealRequestData.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/models/eft/health/IOffraidHealRequestData.d.ts @@ -7,12 +7,12 @@ export interface IOffraidHealRequestData extends IBaseInteractionRequestData { time: number; } export declare enum BodyPart { - Head = 0, - Chest = 1, - Stomach = 2, - LeftArm = 3, - RightArm = 4, - LeftLeg = 5, - RightLeg = 6, - Common = 7 + HEAD = "Head", + CHEST = "Chest", + STOMACH = "Stomach", + LEFT_ARM = "LeftArm", + RIGHT_ARM = "RightArm", + LEFT_LEG = "LeftLeg", + RIGHT_LEG = "RightLeg", + COMMON = "Common" } diff --git a/Live/CWX_BushWhacker/server/dist/types/models/eft/notifier/INotifier.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/eft/notifier/INotifier.d.ts index 8c48260..b248636 100644 --- a/Live/CWX_BushWhacker/server/dist/types/models/eft/notifier/INotifier.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/models/eft/notifier/INotifier.d.ts @@ -1,9 +1,9 @@ export interface INotifierChannel { - "server": string; - "channel_id": string; - "url": string; - "notifierServer": string; - "ws": string; + server: string; + channel_id: string; + url: string; + notifierServer: string; + ws: string; } import { Message } from "../profile/IAkiProfile"; export interface INotification { diff --git a/Live/CWX_BushWhacker/server/dist/types/models/eft/ragfair/IRagfairOffer.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/eft/ragfair/IRagfairOffer.d.ts index 63f655e..141b605 100644 --- a/Live/CWX_BushWhacker/server/dist/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -15,6 +15,8 @@ export interface IRagfairOffer { name?: string; shortName?: string; loyaltyLevel: number; + buyRestrictionMax?: number; + buyRestrictionCurrent?: number; locked: boolean; unlimitedCount: boolean; summaryCost: number; diff --git a/Live/CWX_BushWhacker/server/dist/types/models/enums/AmmoTypes.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/enums/AmmoTypes.d.ts index b52ddcf..254b410 100644 --- a/Live/CWX_BushWhacker/server/dist/types/models/enums/AmmoTypes.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/models/enums/AmmoTypes.d.ts @@ -23,7 +23,7 @@ export declare enum Ammo762x54 { BT_GZH = "5e023d34e8a400319a28ed44", BS_GZH = "5e023d48186a883be655e551" } -export declare enum Ammo338Lapua { +export declare enum Ammo86x70 { TAC_X = "5fc382b6d6fa9c00c571bbc3", UCW = "5fc382c1016cce60e8341b20", AP = "5fc382a9d724d907e2077dab", @@ -85,13 +85,13 @@ export declare enum Ammo9x21 { PE_GZH = "5a26ac06c4a282000c5a90a8", BT_GZH = "5a26ac0ec4a28200741e1e18" } -export declare enum Ammo357Mag { +export declare enum Ammo9x33R { FMJ = "62330b3ed4dc74626d570b95", HOLLOW_POINT = "62330bfadc5883093563729b", SOFT_POINT = "62330c40bdd19b369e1e53d1", JACKET_HP = "62330c18744e5e31df12f516" } -export declare enum Ammo45ACP { +export declare enum Ammo1143x23ACP { MATCH_FMJ = "5e81f423763d9f754677bf2e", HYDRA_SHOK = "5efb0fc6aeb21837e749c801", LASERMATCH_FMJ = "5efb0d4f4bc50b58e81710f3", @@ -126,7 +126,7 @@ export declare enum Ammo556x45 { MK_318_MOD_0_SOST = "60194943740c5d77f6705eea", SSA_AP = "601949593ae8f707c4608daa" } -export declare enum Ammo300Blackout { +export declare enum Ammo762x35 { M62_TRACER = "619636be6db0f2477964e710", BCP_FMJ = "5fbe3ffdf8b6a877a729ea82", AP = "5fd20ff893a8961fc660a954", diff --git a/Live/CWX_BushWhacker/server/dist/types/models/enums/BaseClasses.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/enums/BaseClasses.d.ts index e733bca..36ebc71 100644 --- a/Live/CWX_BushWhacker/server/dist/types/models/enums/BaseClasses.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/models/enums/BaseClasses.d.ts @@ -25,6 +25,7 @@ export declare enum BaseClasses { SIGHTS = "5448fe7a4bdc2d6f028b456b", MEDS = "543be5664bdc2dd4348b4569", MONEY = "543be5dd4bdc2deb348b4569", + NIGHTVISION = "5a2c3a9486f774688b05e574", KEY = "543be5e94bdc2df1348b4568", KEY_MECHANICAL = "5c99f98d86f7745c314214b3", KEYCARD = "5c164d2286f774194c5e69fa", @@ -66,8 +67,8 @@ export declare enum BaseClasses { LUBRICANT = "57864e4c24597754843f8723", BATTERY = "57864ee62459775490116fc1", ASSAULT_SCOPE = "55818add4bdc2d5b648b456f", - REFLEX_SIGHT = "55818ad54bdc2ddc698b4569", TACTICAL_COMBO = "55818b164bdc2ddc698b456c", + FLASHLIGHT = "55818b084bdc2d5b648b4571", MAGAZINE = "5448bc234bdc2d3c308b4569", LIGHT_LASER = "55818b0e4bdc2dde698b456e", FLASH_HIDER = "550aa4bf4bdc2dd6348b456b", diff --git a/Live/CWX_BushWhacker/server/dist/types/models/enums/BotAmount.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/enums/BotAmount.d.ts index d0e1df1..9ef9cab 100644 --- a/Live/CWX_BushWhacker/server/dist/types/models/enums/BotAmount.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/models/enums/BotAmount.d.ts @@ -1,7 +1,7 @@ export declare enum BotAmount { - AsOnline = "AsOnline", - Low = "Low", - Medium = "Medium", - High = "High", - Horde = "Horde" + AS_ONLINE = "AsOnline", + LOW = "Low", + MEDIUM = "Medium", + HIGH = "High", + HORDE = "Horde" } diff --git a/Live/CWX_BushWhacker/server/dist/types/models/enums/BotDifficulty.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/enums/BotDifficulty.d.ts index c901bcf..80e45ad 100644 --- a/Live/CWX_BushWhacker/server/dist/types/models/enums/BotDifficulty.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/models/enums/BotDifficulty.d.ts @@ -1,8 +1,8 @@ export declare enum BotDifficulty { - AsOnline = "AsOnline", - Easy = "Easy", - Medium = "Medium", - Hard = "Hard", - Impossible = "Impossible", - Random = "Random" + AS_ONLINE = "AsOnline", + EASY = "Easy", + MEDIUM = "Medium", + HARD = "Hard", + IMPOSSIBLE = "Impossible", + RANDOM = "Random" } diff --git a/Live/CWX_BushWhacker/server/dist/types/models/enums/ConfigTypes.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/enums/ConfigTypes.d.ts index 61d6f99..468ece5 100644 --- a/Live/CWX_BushWhacker/server/dist/types/models/enums/ConfigTypes.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/models/enums/ConfigTypes.d.ts @@ -8,6 +8,7 @@ export declare enum ConfigTypes { IN_RAID = "aki-inraid", INSURANCE = "aki-insurance", INVENTORY = "aki-inventory", + ITEM = "aki-item", LOCALE = "aki-locale", LOCATION = "aki-location", MATCH = "aki-match", diff --git a/Live/CWX_BushWhacker/server/dist/types/models/enums/ELocationName.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/enums/ELocationName.d.ts index b56cc08..7ae7caa 100644 --- a/Live/CWX_BushWhacker/server/dist/types/models/enums/ELocationName.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/models/enums/ELocationName.d.ts @@ -1,5 +1,6 @@ export declare enum ELocationName { FACTORY_DAY = "factory4_day", + FACTORY_NIGHT = "factory4_night", BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", diff --git a/Live/CWX_BushWhacker/server/dist/types/models/enums/MemberCategory.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/enums/MemberCategory.d.ts index 3bd9a21..a81380e 100644 --- a/Live/CWX_BushWhacker/server/dist/types/models/enums/MemberCategory.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/models/enums/MemberCategory.d.ts @@ -1,13 +1,13 @@ export declare enum MemberCategory { - Default = 0, - Developer = 1, - UniqueId = 2, - Trader = 4, - Group = 8, - System = 16, - ChatModerator = 32, - ChatModeratorWithPermanentBan = 64, - UnitTest = 128, - Sherpa = 256, - Emissary = 512 + DEFAULT = 0, + DEVELOPER = 1, + UNIQUE_ID = 2, + TRADER = 4, + GROUP = 8, + SYSTEM = 16, + CHAT_MODERATOR = 32, + CHAT_MODERATOR_WITH_PERMANENT_BAN = 64, + UNIT_TEST = 128, + SHERPA = 256, + EMISSARY = 512 } diff --git a/Live/CWX_BushWhacker/server/dist/types/models/enums/QuestRewardType.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/enums/QuestRewardType.d.ts index 1d3db86..16f7e39 100644 --- a/Live/CWX_BushWhacker/server/dist/types/models/enums/QuestRewardType.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/models/enums/QuestRewardType.d.ts @@ -1,8 +1,8 @@ export declare enum QuestRewardType { - Skill = "Skill", - Experience = "Experience", - TraderStanding = "TraderStanding", - TraderUnlock = "TraderUnlock", - Item = "Item", - AssortmentUnlock = "AssortmentUnlock" + SKILL = "Skill", + EXPERIENCE = "Experience", + TRADER_STANDING = "TraderStanding", + TRADER_UNLOCK = "TraderUnlock", + ITEM = "Item", + ASSORTMENT_UNLOCK = "AssortmentUnlock" } diff --git a/Live/CWX_BushWhacker/server/dist/types/models/enums/RaidMode.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/enums/RaidMode.d.ts index c5a8cff..e20cf3f 100644 --- a/Live/CWX_BushWhacker/server/dist/types/models/enums/RaidMode.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/models/enums/RaidMode.d.ts @@ -1,5 +1,5 @@ export declare enum RaidMode { - Online = "Online", - Local = "Local", - Coop = "Coop" + ONLINE = "Online", + LOCAL = "Local", + COOP = "Coop" } diff --git a/Live/CWX_BushWhacker/server/dist/types/models/enums/WeaponTypes.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/enums/WeaponTypes.d.ts new file mode 100644 index 0000000..867b052 --- /dev/null +++ b/Live/CWX_BushWhacker/server/dist/types/models/enums/WeaponTypes.d.ts @@ -0,0 +1,151 @@ +export declare enum Weapons127x55 { + ASH_12 = "5cadfbf7ae92152ac412eeef" +} +export declare enum Weapons86x70 { + MK_18 = "5fc22d7c187fea44d52eda44", + AXMC = "627e14b21713922ded6f2c15" +} +export declare enum Weapons9x39 { + AS_VAL = "57c44b372459772d2b39b8ce", + VSS_VINTOREZ = "57838ad32459774a17445cd2" +} +export declare enum Weapons762x54R { + SVDS = "5c46fbd72e2216398b5a8c9c", + MP_18 = "61f7c9e189e6fb1a5e3ea78d", + MOSIN_INFANTRY = "5bfd297f0db834001a669119", + MOSIN_SNIPER = "5ae08f0a5acfc408fb1398a1", + SV_98 = "55801eed4bdc2d89578b4588" +} +export declare enum Weapons762x51 { + VPO_101 = "5c501a4d2e221602b412b540", + DT_MDR_762 = "5dcbd56fdbd3d91b3e5468d5", + SA_58 = "5b0bbe4e5acfc40dc528a72d", + SCARH_BLACK = "6183afd850224f204c1da514", + SCARH_FDE = "6165ac306ef05c2ce828ef74", + HK_G28 = "6176aca650224f204c1da3fb", + M1A = "5aafa857e5b5b00018480968", + RFB = "5f2a9575926fd9352339381f", + RSASS = "5a367e5dc4a282000e49738f", + SR_25 = "5df8ce05b11454561e39243b", + DVL_10 = "588892092459774ac91d4b11", + M700 = "5bfea6e90db834001b7347f3", + T5000M = "5df24cf80dee1b22f862e9bc" +} +export declare enum Weapons366TKM { + VPO_209 = "59e6687d86f77411d949b251", + VPO_215 = "5de652c31b7e3716273428be" +} +export declare enum Weapons762x39 { + OP_SKS = "587e02ff24597743df3deaeb", + SKS = "574d967124597745970e7c94", + AK_103 = "5ac66d2e5acfc43b321d4b53", + AK_104 = "5ac66d725acfc43b321d4b60", + AKM = "59d6088586f774275f37482f", + AKMN = "5a0ec13bfcdbcb00165aa685", + AKMS = "59ff346386f77477562ff5e2", + AKMSN = "5abcbc27d8ce8700182eceeb", + MK47_MUTANT = "606587252535c57a13424cfd", + RD_704 = "628a60ae6b1d481ff772e9c8", + VPO_136 = "59e6152586f77473dc057aa1" +} +export declare enum Weapons762x35 { + MCX = "5fbcc1d9016cce60e8341ab3" +} +export declare enum Weapons556x45 { + ADAR_2_15 = "5c07c60e0db834002330051f", + AK_101 = "5ac66cb05acfc40198510a10", + AK_102 = "5ac66d015acfc400180ae6e4", + DT_MDR_556 = "5c488a752e221602b412af63", + HK_416A5 = "5bb2475ed4351e00853264e3", + HK_G36 = "623063e994fc3f7b302a9696", + M4A1 = "5447a9cd4bdc2dbd208b4567", + SCARL_BLACK = "6184055050224f204c1da540", + SCARL_FDE = "618428466ef05c2ce828f218", + TX15_DML = "5d43021ca4b9362eab4b5e25" +} +export declare enum Weapons545x39 { + AK_105 = "5ac66d9b5acfc4001633997a", + AK_74 = "5bf3e03b0db834001d2c4a9c", + AK_74M = "5ac4cd105acfc40016339859", + AK_74N = "5644bd2b4bdc2d3b4c8b4572", + AKS_74 = "5bf3e0490db83400196199af", + AKS_74N = "5ab8e9fcd8ce870019439434", + AKS_74U = "57dc2fa62459775949412633", + AKS_74UB = "5839a40f24597726f856b511", + AKS_74UN = "583990e32459771419544dd2", + SAG_AK = "628b5638ad252a16da6dd245", + SAG_AK_SHORT = "628b9c37a733087d0d7fe84b", + RPK_16 = "5beed0f50db834001c062b12" +} +export declare enum Weapons57x28FN { + FN_57_BLACK = "5d3eb3b0a4b93615055e84d2", + FN_57_FDE = "5d67abc1a4b93614ec50137f", + FN_P90 = "5cc82d76e24e8d00134b4b83" +} +export declare enum Weapons46x30HK { + MP7A1 = "5ba26383d4351e00334c93d9", + MP7A2 = "5bd70322209c4d00d7167b8f" +} +export declare enum Weapons1143x23 { + M1911A1 = "5e81c3cbac2bb513793cdc75", + M45A1 = "5f36a0e5fbf956000b716b65", + USP45 = "6193a720f8ee7e52e42109ed", + UMP45 = "5fc3e272f8b6a877a729eac5", + VECTOR45 = "5fb64bc92b1b027b1f50bcf2" +} +export declare enum Weapons9x33R { + CR_50DS = "61a4c8884f95bc3b2c5dc96f" +} +export declare enum Weapons9x21 { + SR_1MP = "59f98b4986f7746f546d2cef" +} +export declare enum Weapons9x19 { + GLOCK_17 = "5a7ae0c351dfba0017554310", + GLOCK_18C = "5b1fa9b25acfc40018633c01", + M9A3 = "5cadc190ae921500103bb3b6", + MP_443 = "576a581d2459771e7b1bc4f1", + P226R = "56d59856d2720bd8418b456a", + PL_15 = "602a9740da11d6478d5a06dc", + CR_200DS = "624c2e8614da335f1e034d8c", + MP5 = "5926bb2186f7744b1c6c6e60", + MP5K = "5d2f0d8048f0356c925bc3b0", + MP9 = "5e00903ae9dc277128008b87", + MP9_N = "5de7bd7bfd6b4e6e2276dc25", + MPX = "58948c8e86f77409493f7266", + PP_19_01 = "59984ab886f7743e98271174", + SAIGA_9 = "59f9cabd86f7743a10721f46", + STM_9 = "60339954d62c9b14ed777c06", + VECTOR_9MM = "5fc3f2d5900b1d5091531e57" +} +export declare enum Weapons9x18 { + APB = "5abccb7dd8ce87001773e277", + APS = "5a17f98cfcdbcb0980087290", + PB_SILENCED = "56e0598dd2720bb5668b45a6", + PM = "5448bd6b4bdc2dfc2f8b4569", + PM_T = "579204f224597773d619e051", + PP9_KLIN = "57f4c844245977379d5c14d1", + PP91_KEDR = "57d14d2524597714373db789", + PP91_KEDRB = "57f3c6bd24597738e730fa2f" +} +export declare enum Weapons762x25 { + TT = "571a12c42459771f627b58a0", + TT_GOLD = "5b3b713c5acfc4330140bd8d", + PPSH_41 = "5ea03f7400685063ec28bfa8" +} +export declare enum Weapons12Gauge { + M3_SUPER90 = "6259b864ebedf17603599e88", + M590A1 = "5e870397991fd70db46995c8", + M870 = "5a7828548dc32e5a9c28b516", + MP_133 = "54491c4f4bdc2db1078b4568", + MP_153 = "56dee2bdd2720bc8328b4567", + MP_155 = "606dae0ab0e443224b421bb7", + MP_43_1C = "5580223e4bdc2d1c128b457f", + MTS_255_12 = "60db29ce99594040e04c4a27", + SAIGA_12GA = "576165642459773c7a400233" +} +export declare enum Weapons20Gauge { + TOZ_106 = "5a38e6bac4a2826c6e06d79b" +} +export declare enum Weapons23x75 { + KS_23M = "5e848cc2988a8701445df1e8" +} diff --git a/Live/CWX_BushWhacker/server/dist/types/models/spt/bots/BotLootCache.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/spt/bots/BotLootCache.d.ts index e185315..aedf7b0 100644 --- a/Live/CWX_BushWhacker/server/dist/types/models/spt/bots/BotLootCache.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/models/spt/bots/BotLootCache.d.ts @@ -11,13 +11,13 @@ export declare class BotLootCache { grenadeItems: ITemplateItem[]; } export declare enum LootCacheType { - Special = "Special", - Backpack = "Backpack", - Pocket = "Pocket", - Vest = "Vest", - Combined = "Combined", - HealingItems = "HealingItems", - DrugItems = "DrugItems", - StimItems = "StimItems", - GrenadeItems = "GrenadeItems" + SPECIAL = "Special", + BACKPACK = "Backpack", + POCKET = "Pocket", + VEST = "Vest", + COMBINED = "Combined", + HEALING_ITEMS = "HealingItems", + DRUG_ITEMS = "DrugItems", + STIM_ITEMS = "StimItems", + GRENADE_ITEMS = "GrenadeItems" } diff --git a/Live/CWX_BushWhacker/server/dist/types/models/spt/config/IAirdropConfig.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/spt/config/IAirdropConfig.d.ts index f4aee89..3edcbdd 100644 --- a/Live/CWX_BushWhacker/server/dist/types/models/spt/config/IAirdropConfig.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/models/spt/config/IAirdropConfig.d.ts @@ -1,14 +1,14 @@ +import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IAirdropConfig extends IBaseConfig { kind: "aki-airdrop"; airdropChancePercent: AirdropChancePercent; - airdropMinOpenHeight: number; - airdropMaxOpenHeight: number; planeMinFlyHeight: number; planeMaxFlyHeight: number; planeVolume: number; airdropMinStartTimeSeconds: number; airdropMaxStartTimeSeconds: number; + loot: AirdropLoot; } export interface AirdropChancePercent { bigmap: number; @@ -18,3 +18,13 @@ export interface AirdropChancePercent { interchange: number; reserve: number; } +export interface AirdropLoot { + presetCount: MinMax; + itemCount: MinMax; + itemBlacklist: string[]; + itemTypeWhitelist: string[]; + /** key: item base type: value: max count */ + itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; +} diff --git a/Live/CWX_BushWhacker/server/dist/types/models/spt/config/IBotConfig.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/spt/config/IBotConfig.d.ts index e171087..af8ceba 100644 --- a/Live/CWX_BushWhacker/server/dist/types/models/spt/config/IBotConfig.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/models/spt/config/IBotConfig.d.ts @@ -1,17 +1,31 @@ import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; +import { IBotDurability } from "./IBotDurability"; +import { IPmcConfig } from "./IPmcConfig"; export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; + /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** What bot types should be classified as bosses */ bosses: string[]; - durability: Durability; + /** Control weapon/armor durability min/max values for each bot type */ + durability: IBotDurability; + /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ lootNValue: LootNvalue; + /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; - pmc: PmcConfig; + /** PMC bot specific config settings */ + pmc: IPmcConfig; + /** Control how many items are allowed to spawn on a bot + * key: bottype, value: */ itemSpawnLimits: Record>; - equipment: Record; + /** Blacklist/whitelist items on a bot */ + equipment: Record; + /** Show a bots botType value after their name */ showTypeInNickname: boolean; - maxBotCap: number; + /** Max number of bots that can be spawned in a raid at any one time */ + maxBotCap: Record; + /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; } export interface PresetBatch { @@ -44,79 +58,23 @@ export interface PresetBatch { test: number; exUsec: number; } -export interface Durability { - default: DefaultDurability; - pmc: PmcDurability; - boss: BotDurability; - follower: BotDurability; - assault: BotDurability; - cursedassault: BotDurability; - marksman: BotDurability; - pmcbot: BotDurability; - exusec: BotDurability; - sectantpriest: BotDurability; - sectantwarrior: BotDurability; -} -export interface DefaultDurability { - armor: DefaultArmor; - weapon: WeaponDurability; -} -export interface DefaultArmor { - maxDelta: number; - minDelta: number; -} -export interface WeaponDurability { - lowestMax: number; - highestMax: number; - maxDelta: number; - minDelta: number; -} -export interface PmcDurability { - armor: PmcDurabilityArmor; - weapon: WeaponDurability; -} -export interface PmcDurabilityArmor { - lowestMaxPercent: number; - highestMaxPercent: number; - maxDelta: number; - minDelta: number; -} -export interface BotDurability { - armor: ArmorDurability; - weapon: WeaponDurability; -} -export interface ArmorDurability { - maxDelta: number; - minDelta: number; -} export interface LootNvalue { scav: number; pmc: number; } -export interface PmcConfig { - dynamicLoot: PmcDynamicLoot; - difficulty: string; - looseWeaponInBackpackChancePercent: number; - looseWeaponInBackpackLootMinMax: MinMax; - isUsec: number; - chanceSameSideIsHostilePercent: number; - usecType: string; - bearType: string; - maxBackpackLootTotalRub: number; - maxPocketLootTotalRub: number; - maxVestLootTotalRub: number; - convertIntoPmcChance: Record; - enemyTypes: string[]; -} -export interface PmcDynamicLoot { - whitelist: string[]; - blacklist: string[]; - moneyStackLimits: Record; -} -export interface Equipment { +export interface EquipmentFilters { + weaponModLimits: ModLimits; + randomisedWeaponModSlots?: string[]; + randomisedArmorSlots?: string[]; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; } +export interface ModLimits { + /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ + scopeLimit?: number; + /** How many lasers or lights are allowed on a weapon - hard coded to work with TACTICAL_COMBO, and FLASHLIGHT */ + lightLaserLimit?: number; +} export interface EquipmentFilterDetails { levelRange: MinMax; equipment: Record; diff --git a/Live/CWX_BushWhacker/server/dist/types/models/spt/config/IBotDurability.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/spt/config/IBotDurability.d.ts new file mode 100644 index 0000000..38a47cc --- /dev/null +++ b/Live/CWX_BushWhacker/server/dist/types/models/spt/config/IBotDurability.d.ts @@ -0,0 +1,47 @@ +export interface IBotDurability { + default: DefaultDurability; + pmc: PmcDurability; + boss: BotDurability; + follower: BotDurability; + assault: BotDurability; + cursedassault: BotDurability; + marksman: BotDurability; + pmcbot: BotDurability; + exusec: BotDurability; + gifter: BotDurability; + sectantpriest: BotDurability; + sectantwarrior: BotDurability; +} +/** Durability values to be used when a more specific bot type cant be found */ +export interface DefaultDurability { + armor: DefaultArmor; + weapon: WeaponDurability; +} +export interface DefaultArmor { + maxDelta: number; + minDelta: number; +} +export interface WeaponDurability { + lowestMax: number; + highestMax: number; + maxDelta: number; + minDelta: number; +} +export interface PmcDurability { + armor: PmcDurabilityArmor; + weapon: WeaponDurability; +} +export interface PmcDurabilityArmor { + lowestMaxPercent: number; + highestMaxPercent: number; + maxDelta: number; + minDelta: number; +} +export interface BotDurability { + armor: ArmorDurability; + weapon: WeaponDurability; +} +export interface ArmorDurability { + maxDelta: number; + minDelta: number; +} diff --git a/Live/CWX_BushWhacker/server/dist/types/models/spt/config/IHideoutConfig.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/spt/config/IHideoutConfig.d.ts index 36d6246..f232052 100644 --- a/Live/CWX_BushWhacker/server/dist/types/models/spt/config/IHideoutConfig.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/models/spt/config/IHideoutConfig.d.ts @@ -2,6 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; runIntervalSeconds: number; - fuelDrainRateMultipler: number; hoursForSkillCrafting: number; + generatorSpeedWithoutFuel: number; + generatorFuelFlowRate: number; + airFilterUnitFlowRate: number; + /** SEE HIDEOUTHELPER BEFORE CHANGING CONFIG */ + gpuBoostRate: number; } diff --git a/Live/CWX_BushWhacker/server/dist/types/models/spt/config/IItemConfig.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/spt/config/IItemConfig.d.ts new file mode 100644 index 0000000..5ecccc2 --- /dev/null +++ b/Live/CWX_BushWhacker/server/dist/types/models/spt/config/IItemConfig.d.ts @@ -0,0 +1,5 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface IItemConfig extends IBaseConfig { + kind: "aki-item"; + blacklist: string[]; +} diff --git a/Live/CWX_BushWhacker/server/dist/types/models/spt/config/IPmcConfig.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/spt/config/IPmcConfig.d.ts new file mode 100644 index 0000000..9db2ba1 --- /dev/null +++ b/Live/CWX_BushWhacker/server/dist/types/models/spt/config/IPmcConfig.d.ts @@ -0,0 +1,26 @@ +import { MinMax } from "../../common/MinMax"; +export interface IPmcConfig { + dynamicLoot: DynamicLoot; + useDifficultyOverride: boolean; + difficulty: string; + looseWeaponInBackpackChancePercent: number; + looseWeaponInBackpackLootMinMax: MinMax; + isUsec: number; + chanceSameSideIsHostilePercent: number; + /** key: location, value: type for usec/bear */ + pmcType: Record; + maxBackpackLootTotalRub: number; + maxPocketLootTotalRub: number; + maxVestLootTotalRub: number; + convertIntoPmcChance: Record; + enemyTypes: string[]; +} +export interface PmcTypes { + usec: string; + bear: string; +} +export interface DynamicLoot { + whitelist: string[]; + blacklist: string[]; + moneyStackLimits: Record; +} diff --git a/Live/CWX_BushWhacker/server/dist/types/models/spt/config/IQuestConfig.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/spt/config/IQuestConfig.d.ts index be4a97b..45c9aae 100644 --- a/Live/CWX_BushWhacker/server/dist/types/models/spt/config/IQuestConfig.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/models/spt/config/IQuestConfig.d.ts @@ -4,6 +4,8 @@ export interface IQuestConfig extends IBaseConfig { kind: "aki-quest"; redeemTime: number; repeatableQuests: IRepeatableQuestConfig[]; + bearOnlyQuests: string[]; + usecOnlyQuests: string[]; } export interface IRepeatableQuestConfig { name: string; @@ -15,6 +17,10 @@ export interface IRepeatableQuestConfig { locations: Record; traderWhitelist: ITraderWhitelist[]; questConfig: IQuestConfig; + /** Item base types to block when generating rewards */ + rewardBaseTypeBlacklist: string[]; + /** Item tplIds to ignore when generating rewards */ + rewardBlacklist: string[]; } export interface IRewardScaling { levels: number[]; diff --git a/Live/CWX_BushWhacker/server/dist/types/models/spt/config/IRagfairConfig.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/spt/config/IRagfairConfig.d.ts index c24e617..c1b8763 100644 --- a/Live/CWX_BushWhacker/server/dist/types/models/spt/config/IRagfairConfig.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/models/spt/config/IRagfairConfig.d.ts @@ -12,6 +12,7 @@ export interface Sell { chance: Chance; time: Time; reputation: Reputation; + simulatedSellHours: number; } export interface Chance { base: number; @@ -27,11 +28,18 @@ export interface Reputation { gain: number; loss: number; } +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Dynamic { + offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; price: MinMax; presetPrice: MinMax; + showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; condition: Condition; stackablePercent: MinMax; diff --git a/Live/CWX_BushWhacker/server/dist/types/models/spt/config/ITraderConfig.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/spt/config/ITraderConfig.d.ts index c8e8044..6b1c1e3 100644 --- a/Live/CWX_BushWhacker/server/dist/types/models/spt/config/ITraderConfig.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/models/spt/config/ITraderConfig.d.ts @@ -12,8 +12,10 @@ export interface UpdateTime { seconds: number; } export interface FenceConfig { + partialRefreshTimeSeconds: number; + partialRefreshChangePercent: number; assortSize: number; - maxPresetsCount: number; + maxPresetsPercent: number; presetPriceMult: number; blacklist: string[]; } diff --git a/Live/CWX_BushWhacker/server/dist/types/models/spt/location/AirDropLootItem.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/spt/location/AirDropLootItem.d.ts new file mode 100644 index 0000000..da791ff --- /dev/null +++ b/Live/CWX_BushWhacker/server/dist/types/models/spt/location/AirDropLootItem.d.ts @@ -0,0 +1,6 @@ +export declare class AirDropLootItem { + id: string; + tpl: string; + isPreset: boolean; + stackCount: number; +} diff --git a/Live/CWX_BushWhacker/server/dist/types/models/spt/logging/LogBackgroundColor.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/spt/logging/LogBackgroundColor.d.ts index 87e08a9..1dd369b 100644 --- a/Live/CWX_BushWhacker/server/dist/types/models/spt/logging/LogBackgroundColor.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/models/spt/logging/LogBackgroundColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogBackgroundColor { - default = "", - black = "blackBG", - red = "redBG", - green = "greenBG", - yellow = "yellowBG", - blue = "blueBG", - magenta = "magentaBG", - cyan = "cyanBG", - white = "whiteBG" + DEFAULT = "", + BLACK = "blackBG", + RED = "redBG", + GREEN = "greenBG", + YELLOW = "yellowBG", + BLUE = "blueBG", + MAGENTA = "magentaBG", + CYAN = "cyanBG", + WHITE = "whiteBG" } diff --git a/Live/CWX_BushWhacker/server/dist/types/models/spt/logging/LogTextColor.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/spt/logging/LogTextColor.d.ts index 7147ae3..6c7abf3 100644 --- a/Live/CWX_BushWhacker/server/dist/types/models/spt/logging/LogTextColor.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/models/spt/logging/LogTextColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogTextColor { - black = "black", - red = "red", - green = "green", - yellow = "yellow", - blue = "blue", - magenta = "magenta", - cyan = "cyan", - white = "white", - gray = "" + BLACK = "black", + RED = "red", + GREEN = "green", + YELLOW = "yellow", + BLUE = "blue", + MAGENTA = "magenta", + CYAN = "cyan", + WHITE = "white", + GRAY = "" } diff --git a/Live/CWX_BushWhacker/server/dist/types/models/spt/server/ILocaleBase.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/spt/server/ILocaleBase.d.ts index 8887c06..6e20b89 100644 --- a/Live/CWX_BushWhacker/server/dist/types/models/spt/server/ILocaleBase.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/models/spt/server/ILocaleBase.d.ts @@ -13,10 +13,10 @@ export interface ILocaleGlobalBase { season: Record; customization: Record; repeatableQuest: Record; - templates: ILocaleTemplateBase; - locations: ILocaleLocationsBase; - banners: ILocaleBannersBase; - trading: ILocaleTradingBase; + templates: Record; + locations: Record; + banners: Record; + trading: Record; } export interface ILocaleQuest { name: string; @@ -31,23 +31,11 @@ export interface ILocaleQuest { export interface ILocalePreset { Name: string; } -export interface ILocaleTemplateBase { - templates: Record; -} -export interface ILocaleLocationsBase { - locations: Record; -} -export interface ILocaleBannersBase { - locations: Record; -} export interface ILocaleProps { Name: string; ShortName: string; Description: string; } -export interface ILocaleTradingBase { - locations: Record; -} export interface ILocaleTradingProps { FullName: string; FirstName: string; diff --git a/Live/CWX_BushWhacker/server/dist/types/models/spt/services/LootItem.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/spt/services/LootItem.d.ts new file mode 100644 index 0000000..acb7606 --- /dev/null +++ b/Live/CWX_BushWhacker/server/dist/types/models/spt/services/LootItem.d.ts @@ -0,0 +1,6 @@ +export declare class LootItem { + id?: string; + tpl: string; + isPreset: boolean; + stackCount: number; +} diff --git a/Live/CWX_BushWhacker/server/dist/types/models/spt/services/LootRequest.d.ts b/Live/CWX_BushWhacker/server/dist/types/models/spt/services/LootRequest.d.ts new file mode 100644 index 0000000..1da8770 --- /dev/null +++ b/Live/CWX_BushWhacker/server/dist/types/models/spt/services/LootRequest.d.ts @@ -0,0 +1,11 @@ +import { MinMax } from "../../common/MinMax"; +export declare class LootRequest { + presetCount: MinMax; + itemCount: MinMax; + itemBlacklist: string[]; + itemTypeWhitelist: string[]; + /** key: item base type: value: max count */ + itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; +} diff --git a/Live/CWX_BushWhacker/server/dist/types/servers/DatabaseServer.d.ts b/Live/CWX_BushWhacker/server/dist/types/servers/DatabaseServer.d.ts index aa152d0..b3d29e9 100644 --- a/Live/CWX_BushWhacker/server/dist/types/servers/DatabaseServer.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/servers/DatabaseServer.d.ts @@ -2,5 +2,5 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; export declare class DatabaseServer { protected tableData: IDatabaseTables; getTables(): IDatabaseTables; - setTables(any: any): void; + setTables(tableData: IDatabaseTables): void; } diff --git a/Live/CWX_BushWhacker/server/dist/types/servers/RagfairServer.d.ts b/Live/CWX_BushWhacker/server/dist/types/servers/RagfairServer.d.ts index bc86cdb..c93864b 100644 --- a/Live/CWX_BushWhacker/server/dist/types/servers/RagfairServer.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/servers/RagfairServer.d.ts @@ -1,4 +1,6 @@ import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { TraderAssortHelper } from "../helpers/TraderAssortHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -12,11 +14,18 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected traderHelper: TraderHelper; + protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, configServer: ConfigServer); + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); load(): void; update(): void; + /** + * Get traders who need to be periodically refreshed + * @returns string array of traders + */ + protected getUpdateableTraders(): string[]; getAllCategories(): Record; getBespokeCategories(offers: IRagfairOffer[]): Record; /** diff --git a/Live/CWX_BushWhacker/server/dist/types/services/BotEquipmentFilterService.d.ts b/Live/CWX_BushWhacker/server/dist/types/services/BotEquipmentFilterService.d.ts index e49645b..632f961 100644 --- a/Live/CWX_BushWhacker/server/dist/types/services/BotEquipmentFilterService.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/services/BotEquipmentFilterService.d.ts @@ -1,12 +1,12 @@ import { IBotType } from "../models/eft/common/tables/IBotType"; -import { Equipment, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; protected configServer: ConfigServer; protected botConfig: IBotConfig; - protected botEquipmentFilterlists: Record; + protected botEquipmentFilterlists: Record; constructor(logger: ILogger, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig @@ -22,7 +22,7 @@ export declare class BotEquipmentFilterService { * @param playerLevel Level of the player * @returns EquipmentBlacklistDetails object */ - protected getBotEquipmentBlacklist(botRole: string, playerLevel: number): EquipmentFilterDetails; + getBotEquipmentBlacklist(botRole: string, playerLevel: number): EquipmentFilterDetails; /** * Get the whitelist for a specific bot type that's within the players level * @param botRole Bot type diff --git a/Live/CWX_BushWhacker/server/dist/types/services/BotGenerationCacheService.d.ts b/Live/CWX_BushWhacker/server/dist/types/services/BotGenerationCacheService.d.ts new file mode 100644 index 0000000..670c583 --- /dev/null +++ b/Live/CWX_BushWhacker/server/dist/types/services/BotGenerationCacheService.d.ts @@ -0,0 +1,52 @@ +import { BotHelper } from "../helpers/BotHelper"; +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotGenerationCacheService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected botHelper: BotHelper; + protected storedBots: IBotBase[]; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); + /** + * Store array of bots in cache, shuffle results before storage + * @param botsToStore + */ + storeBots(botsToStore: IBotBase[]): void; + /** + * Find and return a bot based on its role + * Remove bot from internal array so it can't be retreived again + * @param role role to retreive (assault/bossTagilla etc) + * @returns IBotBase object + */ + getBot(role: string): IBotBase[]; + /** + * Find a bot by its index from cache + * @param indexOfBotToReturn index to find bot by + * @returns bot profile + */ + protected getBotFromCache(indexOfBotToReturn: number): IBotBase; + /** + * Remove bot profile by index from cache + * @param indexOfBotToReturn Index of bot profile to remove + */ + protected removeBotFromCache(indexOfBotToReturn: number): void; + /** + * Get index of bot profile that matches criteria + * @param role role of bot we want + * @param getPmc is requested bot a pmc + * @returns index of found bot + */ + protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; + /** + * Remove all cached bot profiles + */ + clearStoredBots(): void; + /** + * Does cache have bots + * @returns true if empty + */ + cacheIsEmpty(): boolean; +} diff --git a/Live/CWX_BushWhacker/server/dist/types/services/BotLootCacheService.d.ts b/Live/CWX_BushWhacker/server/dist/types/services/BotLootCacheService.d.ts index cc71eee..00ffb9c 100644 --- a/Live/CWX_BushWhacker/server/dist/types/services/BotLootCacheService.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/services/BotLootCacheService.d.ts @@ -34,6 +34,17 @@ export declare class BotLootCacheService { * @param isPmc Is the bot a PMC (alteres what loot is cached) */ protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; + /** + * Sort a pool of item objects by its flea price + * @param poolToSort pool of items to sort + */ + protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; + /** + * Add unique items into combined pool + * @param combinedItemPool Pool of items to add to + * @param itemsToAdd items to add to combined pool if unique + */ + protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; /** * Ammo/grenades have this property * @param props diff --git a/Live/CWX_BushWhacker/server/dist/types/services/FenceService.d.ts b/Live/CWX_BushWhacker/server/dist/types/services/FenceService.d.ts index 79058c6..23fbf52 100644 --- a/Live/CWX_BushWhacker/server/dist/types/services/FenceService.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/services/FenceService.d.ts @@ -11,29 +11,109 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; +import { ItemFilterService } from "./ItemFilterService"; +/** + * Handle actions surrounding Fence + * e.g. generating or refreshing assorts / get next refresh time + */ export declare class FenceService { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); + protected nextMiniRefreshTimestamp: number; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; - getFenceAssorts(): ITraderAssort; - hasExpiredCache(refreshAssort: boolean): boolean; - generateFenceAssortCache(pmcData: IPmcData): void; /** - * Get the fence level the passed in profile has + * Get assorts player can purchase + * Adjust prices based on fence level of player + * @param pmcProfile Player profile + * @returns ITraderAssort + */ + getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Get fence assorts with no price adjustments based on fence rep + * @returns ITraderAssort + */ + getRawFenceAssorts(): ITraderAssort; + /** + * Does fence need to perform a partial refresh because its passed the refresh timer defined in trader.json + * @returns true if it needs a partial refresh + */ + needsPartialRefresh(): boolean; + /** + * Replace a percentage of fence assorts with freshly generated items + */ + performPartialRefresh(): void; + /** + * Increment fence next refresh timestamp by current timestamp + partialRefreshTimeSeconds from config + */ + protected incrementPartialRefreshTime(): void; + /** + * Compare the current fence offer count to what the config wants it to be, + * If value is lower add extra count to value to generate more items to fill gap + * @param existingItemCountToReplace count of items to generate + * @returns number of items to generate + */ + protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + /** + * Choose an item (not mod) at random and remove from assorts + */ + protected removeRandomItemFromAssorts(): void; + /** + * Get an integer rounded count of items to replace based on percentrage from traderConfig value + * @param totalItemCount total item count + * @returns rounded int of items to replace + */ + protected getCountOfItemsToReplace(totalItemCount: number): number; + /** + * Get the count of items fence offers + * @returns number + */ + getOfferCount(): number; + /** + * Create a trader assort for fence + */ + generateFenceAssortCache(): void; + /** + * Create skeleton to hold assort items + * @returns ITraderAssort object + */ + protected createBaseTraderAssortItem(): ITraderAssort; + /** + * Hydrate result parameter object with generated assorts + * @param assortCount Number of assorts to generate + * @param assorts object to add assorts to + */ + protected createAssorts(assortCount: number, assorts: ITraderAssort): void; + /** + * Get the next update timestamp for fence + * @returns future timestamp + */ + getNextFenceUpdateTimestamp(): number; + /** + * Get fence refresh time in seconds + */ + protected getFenceRefreshTime(): number; + /** + * Get fence level the passed in profile has * @param pmcData Player profile - * @returns FenceLevel + * @returns FenceLevel object */ getFenceInfo(pmcData: IPmcData): FenceLevel; + /** + * Remove an assort from fence by id + * @param assortIdToRemove assort id to remove from fence assorts + */ removeFenceOffer(assortIdToRemove: string): void; - updateFenceOffers(pmcData: IPmcData): void; } diff --git a/Live/CWX_BushWhacker/server/dist/types/services/InsuranceService.d.ts b/Live/CWX_BushWhacker/server/dist/types/services/InsuranceService.d.ts index 171bf10..6be8a2f 100644 --- a/Live/CWX_BushWhacker/server/dist/types/services/InsuranceService.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/services/InsuranceService.d.ts @@ -2,6 +2,7 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { InsuredItem } from "../models/eft/common/tables/IBotBase"; import { Item } from "../models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; @@ -44,8 +45,22 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; + /** + * Store lost gear post-raid inside profile + * @param pmcData player profile to store gear in + * @param offraidData post-raid request object + * @param preRaidGear gear player wore prior to raid + * @param sessionID Session id + */ storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string): void; storeInsuredItemsForReturn(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string): void; - protected addGearToSend(pmcData: IPmcData, insuredItem: any, actualItem: any, sessionID: string): any; + /** + * Add gear item to InsuredItems array in player profile + * @param pmcData profile to store item in + * @param insuredItem Item to store in profile + * @param actualItem item to store + * @param sessionID Session id + */ + protected addGearToSend(pmcData: IPmcData, insuredItem: InsuredItem, actualItem: Item, sessionID: string): void; getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; } diff --git a/Live/CWX_BushWhacker/server/dist/types/services/ItemFilterService.d.ts b/Live/CWX_BushWhacker/server/dist/types/services/ItemFilterService.d.ts new file mode 100644 index 0000000..c9c8ef3 --- /dev/null +++ b/Live/CWX_BushWhacker/server/dist/types/services/ItemFilterService.d.ts @@ -0,0 +1,24 @@ +import { IItemConfig } from "../models/spt/config/IItemConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +/** Centralise the handling of blacklisting items, uses blacklist found in config/item.json */ +export declare class ItemFilterService { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected blacklist: string[]; + protected itemConfig: IItemConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Check if the provided template id is blacklisted in config/item.json + * @param tpl template id + * @returns true if blacklisted + */ + isItemBlacklisted(tpl: string): boolean; + /** + * Return every template id blacklisted in config/item.json + * @returns string array of blacklisted tempalte ids + */ + getBlacklistedItems(): string[]; +} diff --git a/Live/CWX_BushWhacker/server/dist/types/services/PmcAiService.d.ts b/Live/CWX_BushWhacker/server/dist/types/services/PmcAiService.d.ts new file mode 100644 index 0000000..0690f1f --- /dev/null +++ b/Live/CWX_BushWhacker/server/dist/types/services/PmcAiService.d.ts @@ -0,0 +1,27 @@ +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +/** Storing/retreving pmcRoles set at the start of a raid - its done at that point as we know what location the player is heading to */ +export declare class PmcAiService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + protected usecRole: string; + protected bearRole: string; + constructor(logger: ILogger, configServer: ConfigServer); + /** + * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) + * @param pmcSide eft side (usec/bear) + * @returns pmc side as defined in config + */ + getPmcRole(pmcSide: "usec" | "bear" | string): string; + /** + * Set the roles for pmcs + * @param location map location to look up and use as pmc types + */ + setPmcRolesByLocation(location: string): void; + /** + * Clear the saved role from usec/bear PMCs + */ + clearPmcRoles(): void; +} diff --git a/Live/CWX_BushWhacker/server/dist/types/services/ProfileFixerService.d.ts b/Live/CWX_BushWhacker/server/dist/types/services/ProfileFixerService.d.ts index ed1dec7..9cb5a38 100644 --- a/Live/CWX_BushWhacker/server/dist/types/services/ProfileFixerService.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/services/ProfileFixerService.d.ts @@ -45,6 +45,11 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to find and remove slots from */ protected removeResourcesFromSlotsInHideoutWithoutLocationIndexValue(pmcProfile: IPmcData): void; + /** + * Hideout slots need to be in a specific order, locationIndex in ascending order + * @param pmcProfile profile to edit + */ + protected reorderHideoutAreasWithResouceInputs(pmcProfile: IPmcData): void; /** * add in objects equal to the number of slots * @param areaType area to check diff --git a/Live/CWX_BushWhacker/server/dist/types/services/ProfileSnapshotService.d.ts b/Live/CWX_BushWhacker/server/dist/types/services/ProfileSnapshotService.d.ts new file mode 100644 index 0000000..445ffd0 --- /dev/null +++ b/Live/CWX_BushWhacker/server/dist/types/services/ProfileSnapshotService.d.ts @@ -0,0 +1,30 @@ +import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { JsonUtil } from "../utils/JsonUtil"; +export declare class ProfileSnapshotService { + protected jsonUtil: JsonUtil; + protected storedProfileSnapshots: Record; + constructor(jsonUtil: JsonUtil); + /** + * Store a profile into an in-memory object + * @param sessionID session id - acts as the key + * @param profile - profile to save + */ + storeProfileSnapshot(sessionID: string, profile: IAkiProfile): void; + /** + * Retreve a stored profile + * @param sessionID key + * @returns A player profile object + */ + getProfileSnapshot(sessionID: string): IAkiProfile; + /** + * Does a profile exists against the provided key + * @param sessionID key + * @returns true if exists + */ + hasProfileSnapshot(sessionID: string): boolean; + /** + * Remove a stored profile by key + * @param sessionID key + */ + clearProfileSnapshot(sessionID: string): void; +} diff --git a/Live/CWX_BushWhacker/server/dist/types/services/RagfairOfferService.d.ts b/Live/CWX_BushWhacker/server/dist/types/services/RagfairOfferService.d.ts index 7398a8f..f9e3a34 100644 --- a/Live/CWX_BushWhacker/server/dist/types/services/RagfairOfferService.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/services/RagfairOfferService.d.ts @@ -24,7 +24,6 @@ export declare class RagfairOfferService { protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected toUpdate: Record; protected expiredOffers: Item[]; protected offers: IRagfairOffer[]; protected ragfairConfig: IRagfairConfig; @@ -38,8 +37,6 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; - setTraderUpdateStatus(traderId: string, shouldUpdate: boolean): void; - shouldTraderBeUpdated(traderID: string): boolean; getExpiredOfferCount(): number; /** * Get an array of expired items not yet processed into new offers @@ -53,12 +50,15 @@ export declare class RagfairOfferService { * @returns offer exists - true */ doesOfferExist(offerId: string): boolean; - getTraders(): Record; - flagTraderForUpdate(expiredOfferUserId: string): void; removeOfferById(offerId: string): void; removeOfferStack(offerID: string, amount: number): void; removeAllOffersByTrader(traderId: string): void; - addTradersToUpdateList(): void; + /** + * Do the trader offers on flea need to be refreshed + * @param traderID Trader to check + * @returns true if they do + */ + traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; /** diff --git a/Live/CWX_BushWhacker/server/dist/types/services/RagfairPriceService.d.ts b/Live/CWX_BushWhacker/server/dist/types/services/RagfairPriceService.d.ts index 679fe1d..466c9e3 100644 --- a/Live/CWX_BushWhacker/server/dist/types/services/RagfairPriceService.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/services/RagfairPriceService.d.ts @@ -27,6 +27,20 @@ export declare class RagfairPriceService { getDynamicPrice(itemTpl: string): number; getAllFleaPrices(): Record; getFleaPriceForItem(tplId: string): number; + /** + * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * @param itemPrice price of item + * @param itemTpl item template Id being checked + * @returns adjusted price value in roubles + */ + protected adjustPriceIfBelowHandbook(itemPrice: number, itemTpl: string): number; + /** + * Get the percentage difference between two values + * @param a numerical value a + * @param b numerical value b + * @returns different in percent + */ + protected getPriceDifference(a: number, b: number): number; getStaticPriceForItem(tplId: string): number; getBarterPrice(barterScheme: IBarterScheme[]): number; getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; diff --git a/Live/CWX_BushWhacker/server/dist/types/services/RepairService.d.ts b/Live/CWX_BushWhacker/server/dist/types/services/RepairService.d.ts new file mode 100644 index 0000000..3e6077c --- /dev/null +++ b/Live/CWX_BushWhacker/server/dist/types/services/RepairService.d.ts @@ -0,0 +1,75 @@ +import { QuestHelper } from "../helpers/QuestHelper"; +import { RepairHelper } from "../helpers/RepairHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { RepairKitsInfo } from "../models/eft/repair/IRepairActionDataRequest"; +import { RepairItem } from "../models/eft/repair/ITraderRepairActionDataRequest"; +import { IRepairConfig } from "../models/spt/config/IRepairConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ItemEventRouter } from "../routers/ItemEventRouter"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { PaymentService } from "./PaymentService"; +export declare class RepairService { + protected logger: ILogger; + protected itemEventRouter: ItemEventRouter; + protected databaseServer: DatabaseServer; + protected questHelper: QuestHelper; + protected traderHelper: TraderHelper; + protected paymentService: PaymentService; + protected repairHelper: RepairHelper; + protected configServer: ConfigServer; + repairConfig: IRepairConfig; + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + /** + * Use trader to repair an items durability + * @param sessionID Session id + * @param pmcData profile to find item to repair in + * @param repairItemDetails details of the item to repair + * @param traderId Trader being used to repair item + * @returns RepairDetails object + */ + repairItemByTrader(sessionID: string, pmcData: IPmcData, repairItemDetails: RepairItem, traderId: string): RepairDetails; + /** + * + * @param sessionID Session id + * @param pmcData profile to take money from + * @param repairedItemId Repaired item id + * @param repairCost Cost to repair item in roubles + * @param traderId Id of the trader who repaired the item / who is paid + * @param output + */ + payForRepair(sessionID: string, pmcData: IPmcData, repairedItemId: string, repairCost: number, traderId: string, output: IItemEventRouterResponse): void; + /** + * Add skill points to profile after repairing an item + * @param sessionId Session id + * @param repairDetails details of item repaired, cost/item + * @param pmcData Profile to add points to + * @param output IItemEventRouterResponse + */ + addRepairSkillPoints(sessionId: string, repairDetails: RepairDetails, pmcData: IPmcData, output: IItemEventRouterResponse): void; + /** + * + * @param sessionId Session id + * @param pmcData Profile to update repaired item in + * @param repairKits Array of Repair kits to use + * @param itemToRepairId Item id to repair + * @param output IItemEventRouterResponse + * @returns Details of repair, item/price + */ + repairItemByKit(sessionId: string, pmcData: IPmcData, repairKits: RepairKitsInfo[], itemToRepairId: string, output: IItemEventRouterResponse): RepairDetails; + /** + * Update repair kits Resource object if it doesn't exist + * @param repairKitDetails Repair kit details from db + * @param repairKitInInventory Repair kit to update + */ + protected addMaxResourceToKitIfMissing(repairKitDetails: ITemplateItem, repairKitInInventory: Item): void; +} +export declare class RepairDetails { + repairCost?: number; + repairedItem: Item; + repairedItemIsArmor: boolean; +} diff --git a/Live/CWX_BushWhacker/server/dist/types/services/TraderAssortService.d.ts b/Live/CWX_BushWhacker/server/dist/types/services/TraderAssortService.d.ts index 5ba2d05..03b4e12 100644 --- a/Live/CWX_BushWhacker/server/dist/types/services/TraderAssortService.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/services/TraderAssortService.d.ts @@ -2,5 +2,10 @@ import { ITraderAssort } from "../models/eft/common/tables/ITrader"; export declare class TraderAssortService { protected pristineTraderAssorts: Record; getPristineTraderAssort(traderId: string): ITraderAssort; + /** + * Store trader assorts inside a class property + * @param traderId Traderid to store assorts against + * @param assort Assorts to store + */ setPristineTraderAssort(traderId: string, assort: ITraderAssort): void; } diff --git a/Live/CWX_BushWhacker/server/dist/types/utils/HashUtil.d.ts b/Live/CWX_BushWhacker/server/dist/types/utils/HashUtil.d.ts index bacbf2a..a8500e1 100644 --- a/Live/CWX_BushWhacker/server/dist/types/utils/HashUtil.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/utils/HashUtil.d.ts @@ -4,8 +4,18 @@ import { TimeUtil } from "./TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; constructor(timeUtil: TimeUtil); + /** + * Create a 24 character id using the sha256 algorithm + current timestamp + * @returns 24 character hash + */ generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + /** + * Create a hash for the data parameter + * @param algorithm algorithm to use to hash + * @param data data to be hashed + * @returns hash value + */ generateHashForData(algorithm: string, data: crypto.BinaryLike): string; } diff --git a/Live/CWX_BushWhacker/server/dist/types/utils/RandomUtil.d.ts b/Live/CWX_BushWhacker/server/dist/types/utils/RandomUtil.d.ts index c24dd60..633e472 100644 --- a/Live/CWX_BushWhacker/server/dist/types/utils/RandomUtil.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/utils/RandomUtil.d.ts @@ -136,7 +136,7 @@ export declare class RandomUtil { * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with ot without replacement from the input array + * @param {boolean} replacement Draw with or without replacement from the input array * @return {array} Array consisting of N random elements */ drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; @@ -150,4 +150,10 @@ export declare class RandomUtil { */ drawRandomFromDict(dict: any, count?: number, replacement?: boolean): any[]; getBiasedRandomNumber(min: number, max: number, shift: number, n: number): number; + /** + * Fisher-Yates shuffle an array + * @param array Array to shuffle + * @returns Shuffled array + */ + shuffle(array: Array): Array; } diff --git a/Live/CWX_BushWhacker/server/dist/types/utils/TimeUtil.d.ts b/Live/CWX_BushWhacker/server/dist/types/utils/TimeUtil.d.ts index eed4e6d..1367e26 100644 --- a/Live/CWX_BushWhacker/server/dist/types/utils/TimeUtil.d.ts +++ b/Live/CWX_BushWhacker/server/dist/types/utils/TimeUtil.d.ts @@ -1,9 +1,16 @@ +/** + * Utility class to handle time related problems + */ export declare class TimeUtil { static readonly oneHourAsSeconds = 3600; formatTime(date: Date): string; formatDate(date: Date): string; getDate(): string; getTime(): string; + /** + * Get timestamp in seconds + * @returns + */ getTimestamp(): number; /** * mail in eft requires time be in a specific format @@ -15,4 +22,10 @@ export declare class TimeUtil { * @returns current date in format: 00.00.0000 (dd.mm.yyyy) */ getDateMailFormat(): string; + /** + * Convert hours into seconds + * @param hours hours to convert to seconds + * @returns number + */ + getHoursAsSeconds(hours: number): number; } diff --git a/Live/CWX_BushWhacker/server/package.json b/Live/CWX_BushWhacker/server/package.json index 2ada0a4..51136cc 100644 --- a/Live/CWX_BushWhacker/server/package.json +++ b/Live/CWX_BushWhacker/server/package.json @@ -1,10 +1,10 @@ { "name": "BushWhacker", "author": "CWX", - "version": "1.2.3", + "version": "1.2.4", "license": "NCSA", "main": "src/mod.js", - "akiVersion": "3.2.2", + "akiVersion": "3.2.3", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" ./**/*.* ./dist", diff --git a/Live/CWX_BushWhacker/server/types/callbacks/InsuranceCallbacks.d.ts b/Live/CWX_BushWhacker/server/types/callbacks/InsuranceCallbacks.d.ts index 6819960..8835ba2 100644 --- a/Live/CWX_BushWhacker/server/types/callbacks/InsuranceCallbacks.d.ts +++ b/Live/CWX_BushWhacker/server/types/callbacks/InsuranceCallbacks.d.ts @@ -1,5 +1,5 @@ import { InsuranceController } from "../controllers/InsuranceController"; -import { OnLoadOnUpdate } from "../di/OnLoadOnUpdate"; +import { OnUpdate } from "../di/OnUpdate"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData"; @@ -10,14 +10,13 @@ import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { InsuranceService } from "../services/InsuranceService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -export declare class InsuranceCallbacks extends OnLoadOnUpdate { +export declare class InsuranceCallbacks extends OnUpdate { protected insuranceController: InsuranceController; protected insuranceService: InsuranceService; protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); - onLoad(): void; getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; diff --git a/Live/CWX_BushWhacker/server/types/callbacks/LocationCallbacks.d.ts b/Live/CWX_BushWhacker/server/types/callbacks/LocationCallbacks.d.ts index cc69369..6e0b538 100644 --- a/Live/CWX_BushWhacker/server/types/callbacks/LocationCallbacks.d.ts +++ b/Live/CWX_BushWhacker/server/types/callbacks/LocationCallbacks.d.ts @@ -11,4 +11,5 @@ export declare class LocationCallbacks { constructor(httpResponse: HttpResponseUtil, locationController: LocationController); getLocationData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocation(url: string, info: IGetLocationRequestData, sessionID: string): IGetBodyResponseData; + getAirdropLoot(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/Live/CWX_BushWhacker/server/types/callbacks/ProfileCallbacks.d.ts b/Live/CWX_BushWhacker/server/types/callbacks/ProfileCallbacks.d.ts index 6a86fc0..183bb0a 100644 --- a/Live/CWX_BushWhacker/server/types/callbacks/ProfileCallbacks.d.ts +++ b/Live/CWX_BushWhacker/server/types/callbacks/ProfileCallbacks.d.ts @@ -1,5 +1,6 @@ import { ProfileController } from "../controllers/ProfileController"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IGetMiniProfileRequestData } from "../models/eft/launcher/IGetMiniProfileRequestData"; @@ -12,20 +13,51 @@ import { ISearchFriendResponse } from "../models/eft/profile/ISearchFriendRespon import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** Handle profile related client events */ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); createProfile(url: string, info: IProfileCreateRequestData, sessionID: string): IGetBodyResponseData; - getProfileData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - regenerateScav(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Get the complete player profile (scav + pmc character) + * @param url + * @param info Empty + * @param sessionID Session id + * @returns Profile object + */ + getProfileData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle the creation of a scav profile for player + * Occurs post-raid and when profile first created immediately after character details are confirmed by player + * @param url + * @param info empty + * @param sessionID Session id + * @returns Profile object + */ + regenerateScav(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/profile/voice/change event + * @param url + * @param info Change voice request object + * @param sessionID Session id + * @returns Client response + */ changeVoice(url: string, info: IProfileChangeVoiceRequestData, sessionID: string): INullResponseData; + /** + * Handle client/game/profile/nickname/change event + * Client allows player to adjust their profile name + * @param url + * @param info Change nickname request object + * @param sessionID Session id + * @returns client response + */ changeNickname(url: string, info: IProfileChangeNicknameRequestData, sessionID: string): IGetBodyResponseData; validateNickname(url: string, info: IValidateNicknameRequestData, sessionID: string): IGetBodyResponseData; getReservedNickname(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** - * Called when creating a character, when you choose a character face/voice + * Called when creating a character when choosing a character face/voice * @param url * @param info response (empty) * @param sessionID diff --git a/Live/CWX_BushWhacker/server/types/callbacks/RagfairCallbacks.d.ts b/Live/CWX_BushWhacker/server/types/callbacks/RagfairCallbacks.d.ts index 3a405c9..c609f2f 100644 --- a/Live/CWX_BushWhacker/server/types/callbacks/RagfairCallbacks.d.ts +++ b/Live/CWX_BushWhacker/server/types/callbacks/RagfairCallbacks.d.ts @@ -19,6 +19,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; +/** + * Handle ragfair related callback events + */ export declare class RagfairCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; protected logger: ILogger; diff --git a/Live/CWX_BushWhacker/server/types/callbacks/RepairCallbacks.d.ts b/Live/CWX_BushWhacker/server/types/callbacks/RepairCallbacks.d.ts index 63733fa..14edeeb 100644 --- a/Live/CWX_BushWhacker/server/types/callbacks/RepairCallbacks.d.ts +++ b/Live/CWX_BushWhacker/server/types/callbacks/RepairCallbacks.d.ts @@ -6,6 +6,20 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa export declare class RepairCallbacks { protected repairController: RepairController; constructor(repairController: RepairController); + /** + * use trader to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + /** + * Use repair kit to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ repair(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/Live/CWX_BushWhacker/server/types/callbacks/TraderCallbacks.d.ts b/Live/CWX_BushWhacker/server/types/callbacks/TraderCallbacks.d.ts index 128d9b2..e4fd099 100644 --- a/Live/CWX_BushWhacker/server/types/callbacks/TraderCallbacks.d.ts +++ b/Live/CWX_BushWhacker/server/types/callbacks/TraderCallbacks.d.ts @@ -9,10 +9,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); onLoad(): void; + onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - onUpdate(): boolean; } diff --git a/Live/CWX_BushWhacker/server/types/context/ContextVariable.d.ts b/Live/CWX_BushWhacker/server/types/context/ContextVariable.d.ts index e438947..0fe0a63 100644 --- a/Live/CWX_BushWhacker/server/types/context/ContextVariable.d.ts +++ b/Live/CWX_BushWhacker/server/types/context/ContextVariable.d.ts @@ -4,7 +4,7 @@ export declare class ContextVariable { private timestamp; private type; constructor(value: any, type: ContextVariableType); - getValue(): any; + getValue(): T; getTimestamp(): Date; getType(): ContextVariableType; } diff --git a/Live/CWX_BushWhacker/server/types/controllers/BotController.d.ts b/Live/CWX_BushWhacker/server/types/controllers/BotController.d.ts index 5e6f05d..a5111d5 100644 --- a/Live/CWX_BushWhacker/server/types/controllers/BotController.d.ts +++ b/Live/CWX_BushWhacker/server/types/controllers/BotController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotHelper } from "../helpers/BotHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; @@ -5,15 +6,22 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { IBotCore } from "../models/eft/common/tables/IBotCore"; import { Difficulty } from "../models/eft/common/tables/IBotType"; import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; +import { PmcAiService } from "../services/PmcAiService"; export declare class BotController { + protected logger: ILogger; protected databaseServer: DatabaseServer; protected botGenerator: BotGenerator; protected botHelper: BotHelper; + protected pmcAiService: PmcAiService; + protected botGenerationCacheService: BotGenerationCacheService; protected configServer: ConfigServer; + protected applicationContext: ApplicationContext; protected botConfig: IBotConfig; - constructor(databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -29,7 +37,18 @@ export declare class BotController { * @returns Difficulty object */ getBotDifficulty(type: string, difficulty: string): Difficulty; - protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string): Difficulty; + protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Generate bot profiles and store in cache + * @param sessionId Session id + * @param info bot generation request info + * @returns IBotBase array + */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the max number of bots allowed on a map + * Looks up location player is entering when getting cap value + * @returns cap number + */ getBotCap(): number; } diff --git a/Live/CWX_BushWhacker/server/types/controllers/GameController.d.ts b/Live/CWX_BushWhacker/server/types/controllers/GameController.d.ts index 85ec418..2d00898 100644 --- a/Live/CWX_BushWhacker/server/types/controllers/GameController.d.ts +++ b/Live/CWX_BushWhacker/server/types/controllers/GameController.d.ts @@ -7,11 +7,13 @@ import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; protected localeService: LocaleService; @@ -20,9 +22,14 @@ export declare class GameController { protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + /** + * Make non-trigger-spawned raiders spawn earlier + always + */ + protected adjustLabsRaiderSpawnRate(): void; protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; + getValidGameVersion(): any; } diff --git a/Live/CWX_BushWhacker/server/types/controllers/HideoutController.d.ts b/Live/CWX_BushWhacker/server/types/controllers/HideoutController.d.ts index 3eefe1a..dcd8894 100644 --- a/Live/CWX_BushWhacker/server/types/controllers/HideoutController.d.ts +++ b/Live/CWX_BushWhacker/server/types/controllers/HideoutController.d.ts @@ -28,6 +28,7 @@ import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,9 +46,10 @@ export declare class HideoutController { protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/Live/CWX_BushWhacker/server/types/controllers/InraidController.d.ts b/Live/CWX_BushWhacker/server/types/controllers/InraidController.d.ts index b899e7d..102a2fb 100644 --- a/Live/CWX_BushWhacker/server/types/controllers/InraidController.d.ts +++ b/Live/CWX_BushWhacker/server/types/controllers/InraidController.d.ts @@ -5,9 +5,11 @@ import { ItemHelper } from "../helpers/ItemHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; @@ -15,6 +17,7 @@ import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class InraidController { + protected logger: ILogger; protected saveServer: SaveServer; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; @@ -29,16 +32,40 @@ export declare class InraidController { protected inRaidHelper: InRaidHelper; protected configServer: ConfigServer; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Handle updating the profile post-pmc raid + * @param sessionID session id + * @param offraidData post-raid data of raid + */ + protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Reduce body part hp to % of max + * @param pmcData profile to edit + * @param multipler multipler to apply to max health + */ + protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + /** + * Handle updating the profile post-pscav raid + * @param sessionID session id + * @param offraidData post-raid data of raid + */ + protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Is the player dead after a raid - dead is anything other than "survived" / "runner" + * @param statusOnExit exit value from offraidData object + * @returns true if dead + */ + protected isPlayerDead(statusOnExit: string): boolean; /** * Mark inventory items as FiR if player survived raid, otherwise remove FiR from them * @param offraidData Save Progress Request * @param pmcData player profile * @param isPlayerScav Was the player a pScav */ - private markOrRemoveFoundInRaidItems; - private handlePostRaidPlayerScavProcess; - private handlePostRaidPlayerScavKarmaChanges; + protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; } diff --git a/Live/CWX_BushWhacker/server/types/controllers/InventoryController.d.ts b/Live/CWX_BushWhacker/server/types/controllers/InventoryController.d.ts index f57f731..f564919 100644 --- a/Live/CWX_BushWhacker/server/types/controllers/InventoryController.d.ts +++ b/Live/CWX_BushWhacker/server/types/controllers/InventoryController.d.ts @@ -92,7 +92,11 @@ export declare class InventoryController { */ toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; /** - * Handles Tagging of items (primary Containers). + * Add a tag to an inventory item + * @param pmcData profile with item to add tag to + * @param body tag request data + * @param sessionID session id + * @returns client response object */ tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/Live/CWX_BushWhacker/server/types/controllers/LocationController.d.ts b/Live/CWX_BushWhacker/server/types/controllers/LocationController.d.ts index 90b6d7a..9db3205 100644 --- a/Live/CWX_BushWhacker/server/types/controllers/LocationController.d.ts +++ b/Live/CWX_BushWhacker/server/types/controllers/LocationController.d.ts @@ -1,18 +1,33 @@ import { LocationGenerator } from "../generators/LocationGenerator"; +import { LootGenerator } from "../generators/LootGenerator"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; +import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; +import { LootItem } from "../models/spt/services/LootItem"; import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class LocationController { protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected logger: ILogger; protected locationGenerator: LocationGenerator; + protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; - constructor(jsonUtil: JsonUtil, logger: ILogger, locationGenerator: LocationGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil); + protected configServer: ConfigServer; + protected airdropConfig: IAirdropConfig; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; generateAll(): ILocationsGenerateAllResponse; + /** + * Get loot for an airdop container + * Generates it randomly based on config/airdrop.json values + * @returns Array of LootItem + */ + getAirdropLoot(): LootItem[]; } diff --git a/Live/CWX_BushWhacker/server/types/controllers/MatchController.d.ts b/Live/CWX_BushWhacker/server/types/controllers/MatchController.d.ts index 71cb7d3..07f6a89 100644 --- a/Live/CWX_BushWhacker/server/types/controllers/MatchController.d.ts +++ b/Live/CWX_BushWhacker/server/types/controllers/MatchController.d.ts @@ -9,23 +9,33 @@ import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestDa import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; +import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { PmcAiService } from "../services/PmcAiService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { + protected logger: ILogger; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected matchLocationService: MatchLocationService; protected traderHelper: TraderHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; + protected profileSnapshotService: ProfileSnapshotService; + protected pmcAiService: PmcAiService; + protected botGenerationCacheService: BotGenerationCacheService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + protected botConfig: IBotConfig; + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/Live/CWX_BushWhacker/server/types/controllers/QuestController.d.ts b/Live/CWX_BushWhacker/server/types/controllers/QuestController.d.ts index 2cbccfb..282f50e 100644 --- a/Live/CWX_BushWhacker/server/types/controllers/QuestController.d.ts +++ b/Live/CWX_BushWhacker/server/types/controllers/QuestController.d.ts @@ -39,16 +39,31 @@ export declare class QuestController { * @returns array of IQuest */ getClientQuests(sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param side player side (usec/bear) + * @param questId questId to check + */ + protected questIsForOtherSide(side: string, questId: string): boolean; + /** + * Handle the client accepting a quest and starting it + * Send starting rewards if any to player and + * Send start notification if any to player + * @param pmcData Profile to update + * @param acceptedQuest Quest accepted + * @param sessionID Session id + * @returns client response + */ acceptQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; acceptRepeatableQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; /** - * Remove completed quest from profile + * Update completed quest in profile * Add newly unlocked quests to profile * Also recalculate thier level due to exp rewards * @param pmcData Player profile - * @param body completed quest request - * @param sessionID session id - * @returns ItemEvent response + * @param body Completed quest request + * @param sessionID Session id + * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -67,10 +82,20 @@ export declare class QuestController { protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the quests provided + * Update quest in profile, otherwise add fresh quest object with failed status * @param sessionID session id * @param pmcData player profile * @param questsToFail quests to fail */ protected failQuests(sessionID: string, pmcData: IPmcData, questsToFail: IQuest[]): void; handoverQuest(pmcData: IPmcData, body: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Increment a backend counter stored value by an amount, + * Create counter if it does not exist + * @param pmcData Profile to find backend counter in + * @param conditionId backend counter id to update + * @param questId quest id counter is associated with + * @param counterValue value to increment the backend counter with + */ + protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; } diff --git a/Live/CWX_BushWhacker/server/types/controllers/RagfairController.d.ts b/Live/CWX_BushWhacker/server/types/controllers/RagfairController.d.ts index c4ffc15..06af740 100644 --- a/Live/CWX_BushWhacker/server/types/controllers/RagfairController.d.ts +++ b/Live/CWX_BushWhacker/server/types/controllers/RagfairController.d.ts @@ -9,6 +9,7 @@ import { RagfairOfferHelper } from "../helpers/RagfairOfferHelper"; import { RagfairSellHelper } from "../helpers/RagfairSellHelper"; import { RagfairSortHelper } from "../helpers/RagfairSortHelper"; import { RagfairTaxHelper } from "../helpers/RagfairTaxHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; @@ -33,6 +34,9 @@ import { RagfairPriceService } from "../services/RagfairPriceService"; import { RagfairRequiredItemsService } from "../services/RagfairRequiredItemsService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** + * Handle RagfairCallback events + */ export declare class RagfairController { protected logger: ILogger; protected timeUtil: TimeUtil; @@ -52,14 +56,20 @@ export declare class RagfairController { protected handbookHelper: HandbookHelper; protected paymentHelper: PaymentHelper; protected inventoryHelper: InventoryHelper; + protected traderHelper: TraderHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected ragfairOfferGenerator: RagfairOfferGenerator; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + /** + * Update a trader flea offer with buy restrictions stored in the traders assort + * @param offer flea offer to update + */ + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer): void; protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; diff --git a/Live/CWX_BushWhacker/server/types/controllers/RepairController.d.ts b/Live/CWX_BushWhacker/server/types/controllers/RepairController.d.ts index 0e78ef6..ae54a53 100644 --- a/Live/CWX_BushWhacker/server/types/controllers/RepairController.d.ts +++ b/Live/CWX_BushWhacker/server/types/controllers/RepairController.d.ts @@ -8,9 +8,9 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa import { IRepairConfig } from "../models/spt/config/IRepairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; -import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { PaymentService } from "../services/PaymentService"; +import { RepairService } from "../services/RepairService"; export declare class RepairController { protected logger: ILogger; protected itemEventRouter: ItemEventRouter; @@ -19,23 +19,23 @@ export declare class RepairController { protected traderHelper: TraderHelper; protected paymentService: PaymentService; protected repairHelper: RepairHelper; - protected configServer: ConfigServer; + protected repairService: RepairService; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); /** * Repair with trader - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + traderRepair(sessionID: string, body: ITraderRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; /** * Repair with repair kit - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - repairWithKit(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + repairWithKit(sessionID: string, body: IRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; } diff --git a/Live/CWX_BushWhacker/server/types/controllers/RepeatableQuestController.d.ts b/Live/CWX_BushWhacker/server/types/controllers/RepeatableQuestController.d.ts index 98d05dd..4c31a3d 100644 --- a/Live/CWX_BushWhacker/server/types/controllers/RepeatableQuestController.d.ts +++ b/Live/CWX_BushWhacker/server/types/controllers/RepeatableQuestController.d.ts @@ -7,6 +7,7 @@ import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; import { TraderInfo } from "../models/eft/common/tables/IBotBase"; import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; import { ELocationName } from "../models/enums/ELocationName"; @@ -15,6 +16,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -64,9 +66,10 @@ export declare class RepeatableQuestController { protected itemEventRouter: ItemEventRouter; protected paymentService: PaymentService; protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. @@ -217,4 +220,16 @@ export declare class RepeatableQuestController { debugLogRepeatableQuestIds(pmcData: IPmcData): void; probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; changeRepeatableQuest(pmcDataIn: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {*} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; } diff --git a/Live/CWX_BushWhacker/server/types/controllers/TraderController.d.ts b/Live/CWX_BushWhacker/server/types/controllers/TraderController.d.ts index 7bab158..b79f55e 100644 --- a/Live/CWX_BushWhacker/server/types/controllers/TraderController.d.ts +++ b/Live/CWX_BushWhacker/server/types/controllers/TraderController.d.ts @@ -4,6 +4,7 @@ import { TraderHelper } from "../helpers/TraderHelper"; import { IBarterScheme, ITraderAssort, ITraderBase } from "../models/eft/common/tables/ITrader"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -15,12 +16,29 @@ export declare class TraderController { protected traderHelper: TraderHelper; protected timeUtil: TimeUtil; protected traderAssortService: TraderAssortService; + protected fenceService: FenceService; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, fenceService: FenceService, jsonUtil: JsonUtil); + /** + * Runs when onLoad event is fired + * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Store timestamp of next assort refresh in nextResupply property of traders .base object + */ load(): void; - getTrader(traderID: string, sessionID: string): ITraderBase; + /** + * Runs when onUpdate is fired + * If current time is > nextResupply(expire) time of trader, refresh traders assorts and + * Fence is handled slightly differently + * @returns has run + */ + update(): boolean; + /** + * Return an array of all traders + * @param sessionID Session id + * @returns array if ITraderBase objects + */ getAllTraders(sessionID: string): ITraderBase[]; - updateTraders(): boolean; + getTrader(sessionID: string, traderID: string): ITraderBase; getAssort(sessionId: string, traderId: string): ITraderAssort; - getPurchasesData(traderID: string, sessionID: string): Record; + getPurchasesData(sessionID: string, traderID: string): Record; } diff --git a/Live/CWX_BushWhacker/server/types/di/Container.d.ts b/Live/CWX_BushWhacker/server/types/di/Container.d.ts index 17791b0..98d1fa1 100644 --- a/Live/CWX_BushWhacker/server/types/di/Container.d.ts +++ b/Live/CWX_BushWhacker/server/types/di/Container.d.ts @@ -1,4 +1,7 @@ import { DependencyContainer } from "tsyringe"; +/** + * Handle the registration of classes to be used by the Dependency Injection code + */ export declare class Container { static registerTypes(depContainer: DependencyContainer): void; static registerListTypes(depContainer: DependencyContainer): void; diff --git a/Live/CWX_BushWhacker/server/types/generators/BotGenerator.d.ts b/Live/CWX_BushWhacker/server/types/generators/BotGenerator.d.ts index a5fc0ad..2ac51db 100644 --- a/Live/CWX_BushWhacker/server/types/generators/BotGenerator.d.ts +++ b/Live/CWX_BushWhacker/server/types/generators/BotGenerator.d.ts @@ -9,6 +9,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { PmcAiService } from "../services/PmcAiService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -30,9 +31,10 @@ export declare class BotGenerator { protected botEquipmentFilterService: BotEquipmentFilterService; protected botHelper: BotHelper; protected gameEventHelper: GameEventHelper; + protected pmcAiService: PmcAiService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, pmcAiService: PmcAiService, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -40,14 +42,14 @@ export declare class BotGenerator { * @param botTemplate base bot template to use (e.g. assault/pmcbot) * @returns */ - generatePlayerScav(role: string, difficulty: string, botTemplate: IBotType): IBotBase; - generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Choose if a bot should become a PMC by checking if bot type is allowed to become a Pmc in botConfig.convertFromChances and doing a random int check - * @param botRole the bot role to check if should be a pmc - * @returns true if should be a pmc + * Generate an array of bot objects for populate a raid with + * @param sessionId session id + * @param info request object + * @returns bot array */ - protected shouldBotBePmc(botRole: string): boolean; + generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** * Get a randomised PMC side based on bot config value 'isUsec' * @returns pmc side as string @@ -58,12 +60,30 @@ export declare class BotGenerator { * @returns IBotBase object */ protected getCloneOfBotBase(): IBotBase; - protected generateBot(bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + /** + * Create a IBotBase object with equipment/loot/exp etc + * @param sessionId Session id + * @param bot bots base file + * @param role botRole bot will use + * @param node Bot template from db/bots/x.json + * @param isPmc Is bot to be a PMC + * @param isPlayerScav is bot to be a p scav bot + * @returns IBotBase object + */ + protected generateBot(sessionId: string, bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; /** * Log the number of PMCs generated to the debug console + * @param output Generated bot array, ready to send to client */ protected logPmcGeneratedCount(output: IBotBase[]): void; - protected generateRandomLevel(min: number, max: number): BotGenerator.IRandomisedBotLevelResult; + /** + * Return a randomised bot level and exp value + * @param role botRole being generated for + * @param min Min exp value + * @param max Max exp value + * @returns IRandomisedBotLevelResult object + */ + protected generateRandomLevel(role: string, min: number, max: number): BotGenerator.IRandomisedBotLevelResult; /** * Converts health object to the required format * @param healthObj health object from bot json @@ -72,19 +92,23 @@ export declare class BotGenerator { */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; protected generateSkills(skillsObj: Skills): Skills; - /** - * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) - * @param pmcSide eft side (usec/bear) - * @returns pmc side as defined in config - */ - protected getPmcRole(pmcSide: string): string; /** * Iterate through bots inventory and loot to find and remove christmas items (as defined in GameEventHelper) * @param nodeInventory Bots inventory to iterate over */ protected removeChristmasItemsFromBotInventory(nodeInventory: Inventory): void; + /** + * Generate a random Id for a bot and apply to bots _id and aid value + * @param bot bot to update + * @returns updated IBotBase object + */ protected generateId(bot: IBotBase): IBotBase; protected generateInventoryID(profile: IBotBase): IBotBase; + /** + * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * @param requestedDifficulty + * @returns + */ protected getPMCDifficulty(requestedDifficulty: string): string; /** * Add a side-specific (usec/bear) dogtag item to a bots inventory diff --git a/Live/CWX_BushWhacker/server/types/generators/BotInventoryGenerator.d.ts b/Live/CWX_BushWhacker/server/types/generators/BotInventoryGenerator.d.ts index 35d1ee8..c5ed545 100644 --- a/Live/CWX_BushWhacker/server/types/generators/BotInventoryGenerator.d.ts +++ b/Live/CWX_BushWhacker/server/types/generators/BotInventoryGenerator.d.ts @@ -1,13 +1,16 @@ +import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Inventory, Chances, Generation, Mods } from "../models/eft/common/tables/IBotType"; +import { Chances, Generation, Inventory, Mods } from "../models/eft/common/tables/IBotType"; +import { EquipmentSlots } from "../models/enums/EquipmentSlots"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; -import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; -import { BotWeaponGenerator } from "./BotWeaponGenerator"; import { BotLootGenerator } from "./BotLootGenerator"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; +import { BotWeaponGenerator } from "./BotWeaponGenerator"; export declare class BotInventoryGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -17,8 +20,14 @@ export declare class BotInventoryGenerator { protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper); - generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { + slot: EquipmentSlots; + shouldSpawn: boolean; + }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; protected generateInventoryBase(): PmcInventory; } diff --git a/Live/CWX_BushWhacker/server/types/generators/BotLootGenerator.d.ts b/Live/CWX_BushWhacker/server/types/generators/BotLootGenerator.d.ts index c6a3f29..c1f5310 100644 --- a/Live/CWX_BushWhacker/server/types/generators/BotLootGenerator.d.ts +++ b/Live/CWX_BushWhacker/server/types/generators/BotLootGenerator.d.ts @@ -1,4 +1,5 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; @@ -20,11 +21,12 @@ export declare class BotLootGenerator { protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botLootCacheService: BotLootCacheService, configServer: ConfigServer); - generateLoot(templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer); + generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached @@ -47,7 +49,7 @@ export declare class BotLootGenerator { * @param botRole bots role, .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; /** * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from diff --git a/Live/CWX_BushWhacker/server/types/generators/BotWeaponGenerator.d.ts b/Live/CWX_BushWhacker/server/types/generators/BotWeaponGenerator.d.ts index 9215214..487901b 100644 --- a/Live/CWX_BushWhacker/server/types/generators/BotWeaponGenerator.d.ts +++ b/Live/CWX_BushWhacker/server/types/generators/BotWeaponGenerator.d.ts @@ -1,4 +1,5 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { MinMax } from "../models/common/MinMax"; @@ -14,6 +15,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { IInventoryMagGen } from "./weapongen/IInventoryMagGen"; export declare class BotWeaponGenerator { protected jsonUtil: JsonUtil; protected logger: ILogger; @@ -24,11 +26,24 @@ export declare class BotWeaponGenerator { protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; protected configServer: ConfigServer; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, inventoryMagGenComponents: IInventoryMagGen[]); /** - * Get a random weapon from a bots pool of weapons (weighted) + * Pick a random weapon based on weightings and generate a functional weapon + * @param equipmentSlot Primary/secondary/holster + * @param botTemplateInventory e.g. assault.json + * @param weaponParentId + * @param modChances + * @param botRole role of bot, e.g. assault/followerBully + * @param isPmc Is weapon generated for a pmc + * @returns GenerateWeaponResult object + */ + generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + /** + * Get a random weighted weapon from a bots pool of weapons * @param equipmentSlot Primary/secondary/holster * @param botTemplateInventory e.g. assault.json * @returns weapon tpl @@ -39,43 +54,24 @@ export declare class BotWeaponGenerator { * @param weaponTpl weapon tpl to generate (use pickWeightedWeaponTplFromPool()) * @param equipmentSlot slot to fit into, primary/secondary/holster * @param botTemplateInventory e.g. assault.json - * @param weaponParentId - * @param modChances - * @param botRole + * @param weaponParentId ParentId of the weapon being generated + * @param modChances Dictionary of item types and % chance weapon will have that mod + * @param botRole e.g. assault/exusec * @param isPmc * @returns GenerateWeaponResult object */ - generateWeaponByTpl(weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; /** - * Generate an entirely random weapon - * @param equipmentSlot Primary/secondary/holster - * @param botTemplateInventory e.g. assault.json - * @param weaponParentId - * @param modChances - * @param botRole - * @param isPmc - * @returns GenerateWeaponResult object - */ - generateRandomWeapon(equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; - /** - * Create array with weapon base as only element - * Add additional properties as required - * @param weaponTpl - * @param weaponParentId - * @param equipmentSlot - * @param weaponItemTemplate + * Create array with weapon base as only element and + * add additional properties based on weapon type + * @param weaponTpl Weapon tpl to create item with + * @param weaponParentId Weapons parent id + * @param equipmentSlot e.g. primary/secondary/holster + * @param weaponItemTemplate db template for weapon * @param botRole for durability values - * @returns + * @returns Base weapon item in array */ - constructWeaponBaseArray(weaponTpl: string, weaponParentId: string, equipmentSlot: string, weaponItemTemplate: ITemplateItem, botRole: string): Item[]; - /** - * Add compatible magazines to an inventory based on a generated weapon - * @param weaponDetails - * @param magCounts - * @param inventory - * @param botRole the bot type we're getting generating extra mags for - */ - addExtraMagazinesToInventory(weaponDetails: GenerateWeaponResult, magCounts: MinMax, inventory: PmcInventory, botRole: string): void; + protected constructWeaponBaseArray(weaponTpl: string, weaponParentId: string, equipmentSlot: string, weaponItemTemplate: ITemplateItem, botRole: string): Item[]; /** * Get the mods necessary to kit out a weapon to its preset level * @param weaponTpl weapon to find preset for @@ -84,33 +80,21 @@ export declare class BotWeaponGenerator { * @returns array of weapon mods */ protected getPresetWeaponMods(weaponTpl: string, equipmentSlot: string, weaponParentId: string, itemTemplate: ITemplateItem, botRole: string): Item[]; - /** Checks if all required slots are occupied on a weapon and all it's mods */ + /** + * Checks if all required slots are occupied on a weapon and all it's mods + * @param weaponItemArray Weapon + mods + * @returns true if valid + */ protected isWeaponValid(weaponItemArray: Item[]): boolean; /** * Generates extra magazines or bullets (if magazine is internal) and adds them to TacticalVest and Pockets. * Additionally, adds extra bullets to SecuredContainer - * @param weaponMods - * @param weaponTemplate - * @param magCounts - * @param ammoTpl - * @param inventory - * @param botRole the bot type we're getting generating extra mags for - * @returns + * @param generatedWeaponResult object with properties for generated weapon (weapon mods pool / weapon template / ammo tpl) + * @param magCounts Magazine count to add to inventory + * @param inventory Inventory to add magazines to + * @param botRole The bot type we're getting generating extra mags for */ - protected generateExtraMagazines(weaponMods: Item[], weaponTemplate: ITemplateItem, magCounts: MinMax, ammoTpl: string, inventory: PmcInventory, botRole: string): void; - /** - * Get a randomised number of bullets for a specific magazine - * @param magCounts min and max count of magazines - * @param magTemplate magazine to generate bullet count for - * @returns bullet count number - */ - protected getRandomisedBulletCount(magCounts: MinMax, magTemplate: ITemplateItem): number; - /** - * Get a randomised count of magazines - * @param magCounts min and max value returned value can be between - * @returns numberical value of magazine count - */ - protected getRandomisedMagazineCount(magCounts: MinMax): number; + addExtraMagazinesToInventory(generatedWeaponResult: GenerateWeaponResult, magCounts: MinMax, inventory: PmcInventory, botRole: string): void; /** * Add ammo to the secure container * @param stackCount How many stacks of ammo to add @@ -127,21 +111,13 @@ export declare class BotWeaponGenerator { * @returns magazine tpl string */ protected getMagazineTplFromWeaponTemplate(weaponMods: Item[], weaponTemplate: ITemplateItem, botRole: string): string; - /** - * Get a weapons default magazine template id - * @param weaponTemplate weapon to get default magazine for - * @returns tpl of magazine - */ - protected getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - protected addBulletsToVestAndPockets(ammoTpl: string, bulletCount: number, inventory: PmcInventory): void; /** * Finds and return a compatible ammo tpl based on the bots ammo weightings (x.json/inventory/equipment/ammo) * @param ammo a list of ammo tpls the weapon can use * @param weaponTemplate the weapon we want to pick ammo for - * @param isPmc is the ammo being gathered for a pmc (runs pmc ammo filtering) * @returns an ammo tpl that works with the desired gun */ - protected getCompatibleAmmo(ammo: Record>, weaponTemplate: ITemplateItem, isPmc: boolean): string; + protected getWeightedCompatibleAmmo(ammo: Record>, weaponTemplate: ITemplateItem): string; /** * Get a weapons compatible cartridge caliber * @param weaponTemplate Weapon to look up caliber of diff --git a/Live/CWX_BushWhacker/server/types/generators/LocationGenerator.d.ts b/Live/CWX_BushWhacker/server/types/generators/LocationGenerator.d.ts index bd368b5..cc61dcf 100644 --- a/Live/CWX_BushWhacker/server/types/generators/LocationGenerator.d.ts +++ b/Live/CWX_BushWhacker/server/types/generators/LocationGenerator.d.ts @@ -3,10 +3,9 @@ import { GameEventHelper } from "../helpers/GameEventHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; -import { ILooseLoot, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; +import { ILooseLoot, SpawnpointsForced, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; import { Item } from "../models/eft/common/tables/IItem"; import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticLootDetails } from "../models/eft/common/tables/ILootBase"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -36,11 +35,19 @@ export declare class LocationGenerator { generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; + /** + * Create array of loose + forced loot using probability system + * @param dynamicLootDist + * @param staticAmmoDist + * @param locationName Location to generate loot for + * @returns Array of spawn points with loot in them + */ generateDynamicLoot(dynamicLootDist: ILooseLoot, staticAmmoDist: Record, locationName: string): SpawnpointTemplate[]; + /** + * Add forced spawn point loot into loot parameter array + * @param loot array to add forced loot to + * @param forcedSpawnPoints forced loot to add + */ + protected addForcedLoot(loot: SpawnpointTemplate[], forcedSpawnPoints: SpawnpointsForced[]): void; protected createItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; - protected getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; - protected getRandomValidCaliber(magTemplate: ITemplateItem): string; - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; - protected createRandomMagCartridges(magTemplate: ITemplateItem, parentId: string, staticAmmoDist: Record, caliber?: string): Item; - protected createCartidges(parentId: string, ammoTpl: string, stackCount: number): Item; } diff --git a/Live/CWX_BushWhacker/server/types/generators/LootGenerator.d.ts b/Live/CWX_BushWhacker/server/types/generators/LootGenerator.d.ts new file mode 100644 index 0000000..bbc1915 --- /dev/null +++ b/Live/CWX_BushWhacker/server/types/generators/LootGenerator.d.ts @@ -0,0 +1,58 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Preset } from "../models/eft/common/IGlobals"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { LootItem } from "../models/spt/services/LootItem"; +import { LootRequest } from "../models/spt/services/LootRequest"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { HashUtil } from "../utils/HashUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class LootGenerator { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected databaseServer: DatabaseServer; + protected randomUtil: RandomUtil; + protected itemHelper: ItemHelper; + protected itemFilterService: ItemFilterService; + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, itemFilterService: ItemFilterService); + /** + * Generate a list of items based on options passed in + * @param options parameters to adjust what loot is generated + * @returns An array of loot items + */ + createRandomloot(options: LootRequest): LootItem[]; + /** + * Construct item limit record to hold max and current item count + * @param limits limits as defined in config + * @returns record, key: item tplId, value: current/max item count allowed + */ + protected initItemLimitCounter(limits: Record): Record; + /** + * Find a random item in items.json and add to result array + * @param items items to choose from + * @param itemTypeCounts item limit counts + * @param options item filters + * @param result array to add found item to + * @returns true if item was valid and added to pool + */ + protected findAndAddRandomItemToLoot(items: [string, ITemplateItem][], itemTypeCounts: Record, options: LootRequest, result: LootItem[]): boolean; + /** + * + * Find a random item in items.json and add to result array + * @param globalDefaultPresets presets to choose from + * @param itemTypeCounts item limit counts + * @param result array to add found preset to + * @returns true if preset was valid and added to pool + */ + protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, Preset][], itemTypeCounts: Record, result: LootItem[]): boolean; +} diff --git a/Live/CWX_BushWhacker/server/types/generators/PMCLootGenerator.d.ts b/Live/CWX_BushWhacker/server/types/generators/PMCLootGenerator.d.ts index 64e6f7f..b9f2a83 100644 --- a/Live/CWX_BushWhacker/server/types/generators/PMCLootGenerator.d.ts +++ b/Live/CWX_BushWhacker/server/types/generators/PMCLootGenerator.d.ts @@ -1,15 +1,21 @@ import { ItemHelper } from "../helpers/ItemHelper"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ConfigServer } from "../servers/ConfigServer"; import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +/** + * Handle the generation of dynamic PMC loot in pockets and backpacks + * and the removal of blacklisted items + */ export declare class PMCLootGenerator { protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; + protected itemFilterService: ItemFilterService; protected pocketLootPool: string[]; protected backpackLootPool: string[]; protected botConfig: IBotConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService); generatePMCPocketLootPool(): string[]; generatePMCBackpackLootPool(): string[]; } diff --git a/Live/CWX_BushWhacker/server/types/generators/RagfairAssortGenerator.d.ts b/Live/CWX_BushWhacker/server/types/generators/RagfairAssortGenerator.d.ts index cbdd7f2..db4811d 100644 --- a/Live/CWX_BushWhacker/server/types/generators/RagfairAssortGenerator.d.ts +++ b/Live/CWX_BushWhacker/server/types/generators/RagfairAssortGenerator.d.ts @@ -1,5 +1,8 @@ import { ItemHelper } from "../helpers/ItemHelper"; +import { Preset } from "../models/eft/common/IGlobals"; import { Item } from "../models/eft/common/tables/IItem"; +import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -8,18 +11,40 @@ export declare class RagfairAssortGenerator { protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; protected generatedAssortItems: Item[]; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer); + protected ragfairConfig: IRagfairConfig; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); /** * Get an array of unique items that can be sold on the flea * @returns array of unique items */ getAssortItems(): Item[]; + /** + * Check internal generatedAssortItems array has objects + * @returns true if array has objects + */ protected assortsAreGenerated(): boolean; /** * Generate an array of items the flea can sell * @returns array of unique items */ protected generateRagfairAssortItems(): Item[]; + /** + * Get presets from globals.json + * @returns Preset object array + */ + protected getPresets(): Preset[]; + /** + * Get default presets from globals.json + * @returns Preset object array + */ + protected getDefaultPresets(): Preset[]; + /** + * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true + * @param tplId tplid to add to item + * @param id id to add to item + * @returns hydrated Item object + */ protected createRagfairAssortItem(tplId: string, id?: string): Item; } diff --git a/Live/CWX_BushWhacker/server/types/generators/RagfairOfferGenerator.d.ts b/Live/CWX_BushWhacker/server/types/generators/RagfairOfferGenerator.d.ts index 3e7f4cc..317cd6b 100644 --- a/Live/CWX_BushWhacker/server/types/generators/RagfairOfferGenerator.d.ts +++ b/Live/CWX_BushWhacker/server/types/generators/RagfairOfferGenerator.d.ts @@ -41,15 +41,37 @@ export declare class RagfairOfferGenerator { createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; protected getTraderId(userID: string): string; protected getRating(userID: string): number; + /** + * Is the offers user rating growing + * @param userID user to check rating of + * @returns true if its growing + */ protected getRatingGrowing(userID: string): boolean; + /** + * Get number of section until offer should expire + * @param userID Id of the offer owner + * @param time Time the offer is posted + * @returns number of seconds until offer expires + */ protected getOfferEndTime(userID: string, time: number): number; /** * Create multiple offers for items by using a unique list of items we've generated previously - * @param expiredOffers + * @param expiredOffers optional, expired offers to regenerate */ generateDynamicOffers(expiredOffers?: Item[]): void; - generateTraderOffers(traderID: string): void; + /** + * Generate trader offers on flea using the traders assort data + * @param traderID Trader to generate offers for + */ + generateFleaOffersForTrader(traderID: string): void; protected getItemCondition(userID: string, items: Item[], itemDetails: ITemplateItem): Item[]; + /** + * Add missing conditions to an item if needed + * Durabiltiy for repairable items + * HpResource for medical items + * @param item item to add conditions to + * @returns Item with conditions added + */ protected addMissingCondition(item: Item): Item; protected getOfferRequirements(items: Item[]): { count: number; @@ -57,6 +79,14 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a flea offer and store it in the Ragfair server offers array + * @param userID owner of the offer + * @param time time offer is put up + * @param items items in the offer + * @param barterScheme + * @param loyalLevel + * @param price price of offer + * @param sellInOnePiece + * @returns */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/Live/CWX_BushWhacker/server/types/generators/ScavCaseRewardGenerator.d.ts b/Live/CWX_BushWhacker/server/types/generators/ScavCaseRewardGenerator.d.ts index c7d6ab7..89cb5c8 100644 --- a/Live/CWX_BushWhacker/server/types/generators/ScavCaseRewardGenerator.d.ts +++ b/Live/CWX_BushWhacker/server/types/generators/ScavCaseRewardGenerator.d.ts @@ -8,9 +8,13 @@ import { RewardCountAndPriceDetails, ScavCaseRewardCountsAndPrices } from "../mo import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { RagfairPriceService } from "../services/RagfairPriceService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +/** + * Handle the creation of randomised scav case rewards + */ export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; @@ -18,9 +22,10 @@ export declare class ScavCaseRewardGenerator { protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param body client request diff --git a/Live/CWX_BushWhacker/server/types/generators/WeatherGenerator.d.ts b/Live/CWX_BushWhacker/server/types/generators/WeatherGenerator.d.ts index 44cecbb..8ddbe49 100644 --- a/Live/CWX_BushWhacker/server/types/generators/WeatherGenerator.d.ts +++ b/Live/CWX_BushWhacker/server/types/generators/WeatherGenerator.d.ts @@ -1,7 +1,7 @@ import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { ConfigServer } from "../servers/ConfigServer"; import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class WeatherGenerator { @@ -21,11 +21,16 @@ export declare class WeatherGenerator { protected getAcceleratedTime(computedDate: Date): string; /** * Get current time formatted to fit BSGs requirement - * @param computedDate + * @param computedDate date to format into bsg style * @returns */ protected getNormalTime(computedDate: Date): string; - generateWeather(data: IWeatherData): IWeatherData; + /** + * Return randomised Weather data + * @param weatherData weather input data + * @returns Randomised weather data + */ + generateWeather(weatherData: IWeatherData): IWeatherData; protected getWeightedFog(): string; protected getWeightedRain(): number; protected getRandomFloat(node: string): number; diff --git a/Live/CWX_BushWhacker/server/types/generators/weapongen/IInventoryMagGen.d.ts b/Live/CWX_BushWhacker/server/types/generators/weapongen/IInventoryMagGen.d.ts new file mode 100644 index 0000000..792f510 --- /dev/null +++ b/Live/CWX_BushWhacker/server/types/generators/weapongen/IInventoryMagGen.d.ts @@ -0,0 +1,6 @@ +import { InventoryMagGen } from "./InventoryMagGen"; +export interface IInventoryMagGen { + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_BushWhacker/server/types/generators/weapongen/InventoryMagGen.d.ts b/Live/CWX_BushWhacker/server/types/generators/weapongen/InventoryMagGen.d.ts new file mode 100644 index 0000000..30bf79f --- /dev/null +++ b/Live/CWX_BushWhacker/server/types/generators/weapongen/InventoryMagGen.d.ts @@ -0,0 +1,16 @@ +import { MinMax } from "../../models/common/MinMax"; +import { Inventory } from "../../models/eft/common/tables/IBotBase"; +import { ITemplateItem } from "../../models/eft/common/tables/ITemplateItem"; +export declare class InventoryMagGen { + private magCounts; + private magazineTemplate; + private weaponTemplate; + private ammoTemplate; + private pmcInventory; + constructor(magCounts: MinMax, magazineTemplate: ITemplateItem, weaponTemplate: ITemplateItem, ammoTemplate: ITemplateItem, pmcInventory: Inventory); + getMagCount(): MinMax; + getMagazineTemplate(): ITemplateItem; + getWeaponTemplate(): ITemplateItem; + getAmmoTemplate(): ITemplateItem; + getPmcInventory(): Inventory; +} diff --git a/Live/CWX_BushWhacker/server/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts b/Live/CWX_BushWhacker/server/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts new file mode 100644 index 0000000..b754d5f --- /dev/null +++ b/Live/CWX_BushWhacker/server/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts @@ -0,0 +1,12 @@ +import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; +import { RandomUtil } from "../../../utils/RandomUtil"; +import { IInventoryMagGen } from "../IInventoryMagGen"; +import { InventoryMagGen } from "../InventoryMagGen"; +export declare class BarrelInventoryMagGen implements IInventoryMagGen { + protected randomUtil: RandomUtil; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + constructor(randomUtil: RandomUtil, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_BushWhacker/server/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/Live/CWX_BushWhacker/server/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts new file mode 100644 index 0000000..4fcb1e2 --- /dev/null +++ b/Live/CWX_BushWhacker/server/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -0,0 +1,14 @@ +import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; +import { ItemHelper } from "../../../helpers/ItemHelper"; +import { ILogger } from "../../../models/spt/utils/ILogger"; +import { IInventoryMagGen } from "../IInventoryMagGen"; +import { InventoryMagGen } from "../InventoryMagGen"; +export declare class ExternalInventoryMagGen implements IInventoryMagGen { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + constructor(logger: ILogger, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_BushWhacker/server/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts b/Live/CWX_BushWhacker/server/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts new file mode 100644 index 0000000..4548a04 --- /dev/null +++ b/Live/CWX_BushWhacker/server/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts @@ -0,0 +1,10 @@ +import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; +import { IInventoryMagGen } from "../IInventoryMagGen"; +import { InventoryMagGen } from "../InventoryMagGen"; +export declare class InternalMagazineInventoryMagGen implements IInventoryMagGen { + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + constructor(botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_BushWhacker/server/types/helpers/AssortHelper.d.ts b/Live/CWX_BushWhacker/server/types/helpers/AssortHelper.d.ts index 15586b9..bfc157f 100644 --- a/Live/CWX_BushWhacker/server/types/helpers/AssortHelper.d.ts +++ b/Live/CWX_BushWhacker/server/types/helpers/AssortHelper.d.ts @@ -17,7 +17,7 @@ export declare class AssortHelper { * @param assort assort items from a trader * @returns assort items minus locked quest assorts */ - stripLockedQuestAssort(pmcProfile: IPmcData, traderId: string, assort: ITraderAssort): ITraderAssort; + stripLockedQuestAssort(pmcProfile: IPmcData, traderId: string, assort: ITraderAssort, flea?: boolean): ITraderAssort; /** * Remove assorts from a trader that have not been unlocked yet * @param pmcProfile player profile @@ -32,5 +32,5 @@ export declare class AssortHelper { * @param itemID item id to remove from asort * @returns Modified assort */ - removeItemFromAssort(assort: ITraderAssort, itemID: string): ITraderAssort; + removeItemFromAssort(assort: ITraderAssort, itemID: string, flea?: boolean): ITraderAssort; } diff --git a/Live/CWX_BushWhacker/server/types/helpers/BotGeneratorHelper.d.ts b/Live/CWX_BushWhacker/server/types/helpers/BotGeneratorHelper.d.ts index 3cd7256..5e3e501 100644 --- a/Live/CWX_BushWhacker/server/types/helpers/BotGeneratorHelper.d.ts +++ b/Live/CWX_BushWhacker/server/types/helpers/BotGeneratorHelper.d.ts @@ -1,19 +1,33 @@ import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper"; -import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem"; -import { Grid, ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { ItemFilterService } from "../services/ItemFilterService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotWeaponGeneratorHelper } from "./BotWeaponGeneratorHelper"; import { ContainerHelper } from "./ContainerHelper"; import { InventoryHelper } from "./InventoryHelper"; import { ItemHelper } from "./ItemHelper"; import { ProbabilityHelper } from "./ProbabilityHelper"; +import { ProfileHelper } from "./ProfileHelper"; +export declare class BotModLimits { + scope: ItemCount; + scopeMax: number; + scopeBaseTypes: string[]; + flashlightLaser: ItemCount; + flashlightLaserMax: number; + flashlgihtLaserBaseTypes: string[]; +} +export declare class ItemCount { + count: number; +} export declare class BotGeneratorHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -25,16 +39,121 @@ export declare class BotGeneratorHelper { protected itemHelper: ItemHelper; protected inventoryHelper: InventoryHelper; protected containerHelper: ContainerHelper; + protected botEquipmentFilterService: BotEquipmentFilterService; + protected itemFilterService: ItemFilterService; + protected profileHelper: ProfileHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, configServer: ConfigServer); - generateModsForItem(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, configServer: ConfigServer); /** - * Is this magazine cylinder related (revolvers and grenade launchers) - * @param magazineParentName the name of the magazines parent - * @returns true if it is cylinder related + * Check mods are compatible and add to array + * @param equipment Equipment item to add mods to + * @param modPool Mod list to choose frm + * @param parentId parentid of item to add mod to + * @param parentTemplate template objet of item to add mods to + * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @returns Item + compatible mods as an array */ - magazineIsCylinderRelated(magazineParentName: string): boolean; + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + /** + * @param sessionId session id + * @param weapon Weapon to add mods to + * @param modPool Pool of compatible mods to attach to weapon + * @param weaponParentId parentId of weapon + * @param parentWeaponTemplate Weapon which mods will be generated on + * @param modSpawnChances Mod spawn chances + * @param ammoTpl Ammo tpl to use when generating magazines/cartridges + * @param botRole Role of bot weapon is generated for + * @returns Weapon + mods array + */ + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; + /** + * + * @param modSlot + * @param isRandomisableSlot + * @param modsParent + * @param botEquipBlacklist + * @param itemModPool + * @param weapon array with only weapon tpl in it, ready for mods to be added + * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) + * @param parentTemplate + * @returns + */ + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + /** + * Find mod tpls of a provided type and add to modPool + * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) + * @param modTemplate db object for modItem we get compatible mods from + * @param modPool Pool of mods we are adding to + */ + protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; + /** + * Check if mod item is on limited list + has surpassed the limit set for it + * @param botRole role the bot has e.g. assault + * @param modTemplate mods template data + * @param modLimits limits set for weapon being generated for this bot + * @returns true if over item limit + */ + protected modHasReachedItemLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits): boolean; + /** + * Initalise mod limits to be used when generating a weapon + * @param botRole "assault", "bossTagilla" or "pmc" + * @returns BotModLimits object + */ + protected initModLimits(botRole: string): BotModLimits; + /** + * Generate a pool of mods for this bots mod type if bot has values inside `randomisedWeaponModSlots` array found in bot.json/equipment[botrole] + * @param allowedMods Mods to be added to mod pool + * @param botEquipBlacklist blacklist of items not allowed to be added to mod pool + * @param modSlot Slot to generate mods for + * @param itemModPool base mod pool to replace values of + */ + protected generateDynamicWeaponModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record): void; + /** + * Find all compatible mods for equipment item and add to modPool + * @param itemDetails item to find mods for + * @param modPool ModPool to add mods to + */ + generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods): void; + /** + * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist + * @param allowedMods base mods to filter + * @param botEquipBlacklist equipment blacklist + * @param modSlot slot mods belong to + * @returns Filtered array of mod tpls + */ + protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; + /** + * Check if the specific item type on the weapon has reached the set limit + * @param modTpl log mod tpl if over type limit + * @param currentCount current number of this item on gun + * @param maxLimit mod limit allowed + * @param botRole role of bot we're checking weapon of + * @returns true if limit reached + */ + protected weaponModLimitReached(modTpl: string, currentCount: { + count: number; + }, maxLimit: number, botRole: string): boolean; + /** + * Log errors if mod is not compatible with slot + * @param modToAdd template of mod to check + * @param itemSlot slot the item will be placed in + * @param modSlot slot the mod will fill + * @param parentTemplate tempalte of the mods parent item + * @returns true if valid + */ + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + /** + * Create a mod item with parameters as properties + * @param modId _id + * @param modTpl _tpl + * @param parentId parentId + * @param modSlot slotId + * @param modTemplate Used to add additional properites in the upd object + * @returns Item object + */ + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem): Item; /** * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance @@ -46,7 +165,7 @@ export declare class BotGeneratorHelper { protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; /** * Get a list of containers that hold ammo - * e.g. mod_magazine + * e.g. mod_magazine / patron_in_weapon_000 * @returns string array */ protected getAmmoContainers(): string[]; @@ -62,11 +181,11 @@ export declare class BotGeneratorHelper { * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" - * - * @param {object} items The items where the CylinderMagazine's camora are appended to - * @param {object} modPool modPool which should include available cartrigdes - * @param {string} parentId The CylinderMagazine's UID - * @param {object} parentTemplate The CylinderMagazine's template + * @param items The items where the CylinderMagazine's camora are appended to + * @param modPool modPool which should include available cartrigdes + * @param parentId The CylinderMagazine's UID + * @param parentTemplate The CylinderMagazine's template + * @returns */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** @@ -75,6 +194,13 @@ export declare class BotGeneratorHelper { * @returns string array of shells fro luitple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + /** + * Adds properties to an item + * e.g. Repairable / HasHinge / Foldable / MaxDurability + * @param itemTemplate + * @param botRole Used by weapons to randomise the durability values + * @returns Item Upd object with extra properties + */ generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { upd?: Upd; }; @@ -92,13 +218,15 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; - protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** - * Sort by spawn chance, highest to lowest, higher is more common - * @param unsortedModArray String array to sort - * @returns Sorted string array + * Get a random mod from an items compatible mods Filter array + * @param modTpl + * @param parentSlot + * @param modSlot + * @param items + * @returns item tpl */ - protected sortModArray(unsortedModArray: string[]): string[]; + protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** * Can an item be added to an item without issue * @param items @@ -107,18 +235,8 @@ export declare class BotGeneratorHelper { * @returns true if possible */ isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; - /** - * Adds an item with all its childern into specified equipmentSlots, wherever it fits. - * @param equipmentSlots - * @param parentId - * @param parentTpl - * @param itemWithChildren - * @param inventory - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: PmcInventory): boolean; - protected itemAllowedInContainer(slot: Grid, itemTpl: string): boolean; } +/** TODO - move into own class */ export declare class ExhaustableArray { private itemPool; private randomUtil; diff --git a/Live/CWX_BushWhacker/server/types/helpers/BotHelper.d.ts b/Live/CWX_BushWhacker/server/types/helpers/BotHelper.d.ts index 9b89481..18738e5 100644 --- a/Live/CWX_BushWhacker/server/types/helpers/BotHelper.d.ts +++ b/Live/CWX_BushWhacker/server/types/helpers/BotHelper.d.ts @@ -13,11 +13,34 @@ export declare class BotHelper { protected configServer: ConfigServer; protected botConfig: IBotConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, configServer: ConfigServer); + /** + * Get difficulty settings for desired bot type, if not found use assault bot types + * @param type bot type to retreive difficulty of + * @param difficulty difficulty to get settings for (easy/normal etc) + * @returns Difficulty object + */ getBotDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Get a template object for the specified botRole from bots.types db + * @param role botRole to get template for + * @returns IBotType object + */ getBotTemplate(role: string): IBotType; + /** + * Get difficulty settings for a PMC + * @param type "usec" / "bear" + * @param difficulty what difficulty to retrieve + * @returns Difficulty object + */ getPmcDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Choose a random difficulty from - easy/normal/hard/impossible + * @returns random difficulty + */ + chooseRandomDifficulty(): string; /** * Randomise the chance the PMC will attack their own side + * Look up value in bot.json/chanceSameSideIsHostilePercent * @param difficultySettings pmc difficulty settings */ randomisePmcHostility(difficultySettings: Difficulty): void; @@ -31,7 +54,7 @@ export declare class BotHelper { */ addBotToFriendlyList(difficultySettings: Difficulty, typeToAdd: string): void; /** - * Add a bot to the ENEMY_BOT_TYPES array + * Add a bot to the ENEMY_BOT_TYPES array, do not add itself if its on the enemy list * @param difficultySettings bot settings to alter * @param typesToAdd bot type to add to enemy list */ @@ -42,4 +65,10 @@ export declare class BotHelper { * @param typesToAdd bot type to add to revenge list */ addBotToRevengeList(difficultySettings: Difficulty, typesToAdd: string[]): void; + /** + * Choose if a bot should become a PMC by checking if bot type is allowed to become a Pmc in botConfig.convertFromChances and doing a random int check + * @param botRole the bot role to check if should be a pmc + * @returns true if should be a pmc + */ + shouldBotBePmc(botRole: string): boolean; } diff --git a/Live/CWX_BushWhacker/server/types/helpers/BotWeaponGeneratorHelper.d.ts b/Live/CWX_BushWhacker/server/types/helpers/BotWeaponGeneratorHelper.d.ts new file mode 100644 index 0000000..7e25f56 --- /dev/null +++ b/Live/CWX_BushWhacker/server/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -0,0 +1,78 @@ +import { MinMax } from "../models/common/MinMax"; +import { Inventory } from "../models/eft/common/tables/IBotBase"; +import { Item } from "../models/eft/common/tables/IItem"; +import { Grid, ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { HashUtil } from "../utils/HashUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { ContainerHelper } from "./ContainerHelper"; +import { InventoryHelper } from "./InventoryHelper"; +import { ItemHelper } from "./ItemHelper"; +export declare class BotWeaponGeneratorHelper { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper); + /** + * Get a randomised number of bullets for a specific magazine + * @param magCounts min and max count of magazines + * @param magTemplate magazine to generate bullet count for + * @returns bullet count number + */ + getRandomisedBulletCount(magCounts: MinMax, magTemplate: ITemplateItem): number; + /** + * Get a randomised count of magazines + * @param magCounts min and max value returned value can be between + * @returns numberical value of magazine count + */ + getRandomisedMagazineCount(magCounts: MinMax): number; + /** + * Is this magazine cylinder related (revolvers and grenade launchers) + * @param magazineParentName the name of the magazines parent + * @returns true if it is cylinder related + */ + magazineIsCylinderRelated(magazineParentName: string): boolean; + /** + * Create a magazine using the parameters given + * @param magazineTpl Tpl of the magazine to create + * @param ammoTpl Ammo to add to magazine + * @param magTemplate template object of magazine + * @returns Item array + */ + createMagazine(magazineTpl: string, ammoTpl: string, magTemplate: ITemplateItem): Item[]; + /** + * Add a specific number of cartrdiges to a bots inventory (vest/pocket) + * @param ammoTpl Ammo tpl to add to vest/pockets + * @param cartridgeCount number of cartridges to add to vest/pockets + * @param inventory bot inventory to add cartridges to + */ + addBulletsToVestAndPockets(ammoTpl: string, cartridgeCount: number, inventory: Inventory): void; + /** + * Get a weapons default magazine template id + * @param weaponTemplate weapon to get default magazine for + * @returns tpl of magazine + */ + getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; + /** + * Adds an item with all its childern into specified equipmentSlots, wherever it fits. + * @param equipmentSlots + * @param parentId + * @param parentTpl + * @param itemWithChildren + * @param inventory + * @returns a `boolean` indicating item was added + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): boolean; + /** + * is the provided item allowed inside a container + * @param slot location item wants to be placed in + * @param itemTpl item being placed + * @returns true if allowed + */ + protected itemAllowedInContainer(slot: Grid, itemTpl: string): boolean; +} diff --git a/Live/CWX_BushWhacker/server/types/helpers/HideoutHelper.d.ts b/Live/CWX_BushWhacker/server/types/helpers/HideoutHelper.d.ts index 36e4009..7495a6a 100644 --- a/Live/CWX_BushWhacker/server/types/helpers/HideoutHelper.d.ts +++ b/Live/CWX_BushWhacker/server/types/helpers/HideoutHelper.d.ts @@ -44,14 +44,72 @@ export declare class HideoutHelper { initProduction(recipeId: string, productionTime: number): Production; isProductionType(productive: Productive): productive is Production; applyPlayerUpgradesBonuses(pmcData: IPmcData, bonus: StageBonus): void; + /** + * TODO: + * After looking at the skills there doesnt seem to be a configuration per skill to boost + * the XP gain PER skill. I THINK you should be able to put the variable "SkillProgress" (just like health has it) + * and be able to tune the skill gain PER skill, but I havent tested it and Im not sure! + * @param pmcData + * @param bonus + */ protected applySkillXPBoost(pmcData: IPmcData, bonus: StageBonus): void; + /** + * Process a players hideout, update areas that use resources + increment production timers + * @param sessionID Session id + */ updatePlayerHideout(sessionID: string): void; + /** + * Update progress timer for water collector + * @param pmcData profile to update + * @param productionId id of water collection production to update + * @param hideoutProperties Hideout properties + */ + protected updateWaterCollectorProductionTimer(pmcData: IPmcData, productionId: string, hideoutProperties: { + btcFarmCGs?: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Update progress timer for scav case + * @param pmcData Profile to update + * @param productionId Id of scav case production to update + */ + protected updateScavCaseProductionTimer(pmcData: IPmcData, productionId: string): void; + /** + * Iterate over hideout areas that use resources (fuel/filters etc) and update associated values + * @param sessionID Session id + * @param pmcData Profile to update areas of + * @param hideoutProperties hideout properties + */ + protected updateAreasWithResources(sessionID: string, pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): HideoutArea; - protected updateWaterFilters(waterFilterArea: HideoutArea, pwProd: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; + /** + * Adjust water filter objects resourceValue or delete when they reach 0 resource + * @param waterFilterArea water filter area to update + * @param production production object + * @param isGeneratorOn is generatory enabled + * @param pmcData Player profile + * @returns Updated HideoutArea object + */ + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): HideoutArea; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; protected getBTCSlots(pmcData: IPmcData): number; protected getManagementSkillsSlots(): number; diff --git a/Live/CWX_BushWhacker/server/types/helpers/InRaidHelper.d.ts b/Live/CWX_BushWhacker/server/types/helpers/InRaidHelper.d.ts index c3cbfbb..962df38 100644 --- a/Live/CWX_BushWhacker/server/types/helpers/InRaidHelper.d.ts +++ b/Live/CWX_BushWhacker/server/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -15,19 +16,8 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); - /** - * Reset the SPT inraid property stored in a profile to 'none' - * @param sessionID Session id - */ - protected removePlayer(sessionID: string): void; - /** - * Some maps have one-time-use keys (e.g. Labs - * Remove the relevant key from an inventory based on the post-raid request data passed in - * @param offraidData post-raid data - * @param sessionID Session id - */ - protected removeMapAccessKey(offraidData: ISaveProgressRequestData, sessionID: string): void; + protected profileFixerService: ProfileFixerService; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); /** * Check an array of items and add an upd object to money items with a stack count of 1 * Single stack money items have no upd object and thus no StackObjectsCount, causing issues @@ -52,6 +42,18 @@ export declare class InRaidHelper { * @returns Reset profile object */ updateProfileBaseStats(profileData: IPmcData, saveProgressRequest: ISaveProgressRequestData, sessionID: string): IPmcData; + /** + * Some maps have one-time-use keys (e.g. Labs + * Remove the relevant key from an inventory based on the post-raid request data passed in + * @param offraidData post-raid data + * @param sessionID Session id + */ + protected removeMapAccessKey(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Set the SPT inraid location Profile property to 'none' + * @param sessionID Session id + */ + protected setPlayerInRaidLocationStatusToNone(sessionID: string): void; /** * Adds SpawnedInSession property to items found in a raid * Removes SpawnedInSession for non-scav players if item was taken into raid with SpawnedInSession = true @@ -93,5 +95,10 @@ export declare class InRaidHelper { * @returns true if item is kept after death */ isItemKeptAfterDeath(slotId: string): boolean; + /** + * Return the equipped items from a players inventory + * @param items Players inventory to search through + * @returns an array of equipped items + */ getPlayerGear(items: Item[]): Item[]; } diff --git a/Live/CWX_BushWhacker/server/types/helpers/InventoryHelper.d.ts b/Live/CWX_BushWhacker/server/types/helpers/InventoryHelper.d.ts index dc7cbca..b8e5c9d 100644 --- a/Live/CWX_BushWhacker/server/types/helpers/InventoryHelper.d.ts +++ b/Live/CWX_BushWhacker/server/types/helpers/InventoryHelper.d.ts @@ -43,6 +43,7 @@ export declare class InventoryHelper { constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; diff --git a/Live/CWX_BushWhacker/server/types/helpers/ItemHelper.d.ts b/Live/CWX_BushWhacker/server/types/helpers/ItemHelper.d.ts index 1701c62..0effaf2 100644 --- a/Live/CWX_BushWhacker/server/types/helpers/ItemHelper.d.ts +++ b/Live/CWX_BushWhacker/server/types/helpers/ItemHelper.d.ts @@ -1,35 +1,30 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { InsuredItem } from "../models/eft/common/tables/IBotBase"; import { Item, Repairable } from "../models/eft/common/tables/IItem"; +import { IStaticAmmoDetails } from "../models/eft/common/tables/ILootBase"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ObjectId } from "../utils/ObjectId"; +import { RandomUtil } from "../utils/RandomUtil"; declare class ItemHelper { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected randomUtil: RandomUtil; + protected objectId: ObjectId; + protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer); /** - * Checks if a id is a valid item. Valid meaning that it's an item that be stored in stash + * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl * @returns boolean; true for items that may be in player posession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {*} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - isValidRewardItem(tpl: string): boolean; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - getRewardableItems(): [string, ITemplateItem][]; /** * Check if the tpl / template Id provided is a descendent of the baseclass * @@ -84,6 +79,11 @@ declare class ItemHelper { * @returns {array} The array of StackSlotItems */ generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; + /** + * Get cloned copy of all item data from items.json + * @returns array of ITemplateItem objects + */ + getItems(): ITemplateItem[]; /** * Gets item data from items.json * @param tpl items template id to look up @@ -196,6 +196,22 @@ declare class ItemHelper { * @returns ItemSize object (width and height) */ getItemSize(items: Item[], rootItemId: string): ItemHelper.ItemSize; + /** + * Get a random cartridge from an items Filter property + * @param item + * @returns + */ + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + createRandomMagCartridges(magTemplate: ITemplateItem, parentId: string, staticAmmoDist: Record, caliber?: string): Item; + protected getRandomValidCaliber(magTemplate: ITemplateItem): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + createCartidges(parentId: string, ammoTpl: string, stackCount: number): Item; + /** + * Get the size of a stack, return 1 if no stack object count property found + * @param item Item to get stack size of + * @returns size of stack + */ + getItemStackSize(item: Item): number; } declare namespace ItemHelper { interface ItemSize { diff --git a/Live/CWX_BushWhacker/server/types/helpers/ProfileHelper.d.ts b/Live/CWX_BushWhacker/server/types/helpers/ProfileHelper.d.ts index 6c150c8..9c6560a 100644 --- a/Live/CWX_BushWhacker/server/types/helpers/ProfileHelper.d.ts +++ b/Live/CWX_BushWhacker/server/types/helpers/ProfileHelper.d.ts @@ -2,24 +2,41 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Stats } from "../models/eft/common/tables/IBotBase"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; +import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { ItemHelper } from "./ItemHelper"; export declare class ProfileHelper { + protected logger: ILogger; protected jsonUtil: JsonUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected profileSnapshotService: ProfileSnapshotService; protected fenceService: FenceService; - constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; getCompleteProfile(sessionID: string): IPmcData[]; + /** + * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen + * Server saves the post-raid changes prior to the xp screen getting the profile, this results in the xp screen using + * the now updated profile values as a base, meaning it shows x2 xp gained + * Instead, clone the post-raid profile (so we dont alter its values), apply the pre-raid xp values to the cloned objects and return + * Delete snapshot of pre-raid profile prior to returning profile data + * @param sessionId Session id + * @param output pmc and scav profiles array + * @param pmcProfile post-raid pmc profile + * @param scavProfile post-raid scav profile + * @returns updated profile array + */ + protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; /** * Add experience to a PMC inside the players profile diff --git a/Live/CWX_BushWhacker/server/types/helpers/QuestHelper.d.ts b/Live/CWX_BushWhacker/server/types/helpers/QuestHelper.d.ts index 0f68cd5..d66d150 100644 --- a/Live/CWX_BushWhacker/server/types/helpers/QuestHelper.d.ts +++ b/Live/CWX_BushWhacker/server/types/helpers/QuestHelper.d.ts @@ -36,13 +36,30 @@ export declare class QuestHelper { protected configServer: ConfigServer; protected questConfig: IQuestConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); - questStatus(pmcData: IPmcData, questID: string): QuestStatus; /** - * returns true is the condition is satisfied + * Get status of a quest by quest id + * @param pmcData Profile to search + * @param questID Quest id to look up + * @returns QuestStauts enum + */ + getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus; + /** + * returns true is the level condition is satisfied + * @param playerLevel Players level + * @param condition Quest condition + * @returns true if player level is greater than or equal to quest */ - evaluateLevel(pmcProfile: IPmcData, cond: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; - rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progress: number): void; + /** + * Increase skill points of a skill on player profile + * @param sessionID Session id + * @param pmcData Player profile + * @param output output object to send back to client + * @param skillName Name of skill to increase skill points of + * @param progressAmount Amount of skill points to add to skill + */ + rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; getQuestLocale(questId: string): any; /** * Debug Routine for showing some information on the diff --git a/Live/CWX_BushWhacker/server/types/helpers/RagfairOfferHelper.d.ts b/Live/CWX_BushWhacker/server/types/helpers/RagfairOfferHelper.d.ts index 8d03bee..e9d72ca 100644 --- a/Live/CWX_BushWhacker/server/types/helpers/RagfairOfferHelper.d.ts +++ b/Live/CWX_BushWhacker/server/types/helpers/RagfairOfferHelper.d.ts @@ -22,12 +22,14 @@ import { ProfileHelper } from "./ProfileHelper"; import { RagfairHelper } from "./RagfairHelper"; import { RagfairServerHelper } from "./RagfairServerHelper"; import { RagfairSortHelper } from "./RagfairSortHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class RagfairOfferHelper { protected logger: ILogger; protected timeUtil: TimeUtil; protected hashUtil: HashUtil; protected itemEventRouter: ItemEventRouter; protected databaseServer: DatabaseServer; + protected traderHelper: TraderHelper; protected saveServer: SaveServer; protected dialogueHelper: DialogueHelper; protected itemHelper: ItemHelper; @@ -43,10 +45,10 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; - processOffers(sessionID: string): boolean; + processOffersOnProfile(sessionID: string): boolean; protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; diff --git a/Live/CWX_BushWhacker/server/types/helpers/RagfairSellHelper.d.ts b/Live/CWX_BushWhacker/server/types/helpers/RagfairSellHelper.d.ts index 6ec004a..91b8a20 100644 --- a/Live/CWX_BushWhacker/server/types/helpers/RagfairSellHelper.d.ts +++ b/Live/CWX_BushWhacker/server/types/helpers/RagfairSellHelper.d.ts @@ -11,6 +11,12 @@ export declare class RagfairSellHelper { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateSellChance(baseChance: number, offerPrice: number, requirementsPriceInRub: number): number; - rollForSale(sellChance: number, count: number): SellResult[]; + calculateSellChance(baseChancePercent: number, offerPriceRub: number, playerListedPriceRub: number): number; + /** + * Determine if the offer being listed will be sold + * @param sellChancePercent chance item will sell + * @param itemSellCount count of items to sell + * @returns Array of purchases of item(s) lsited + */ + rollForSale(sellChancePercent: number, itemSellCount: number): SellResult[]; } diff --git a/Live/CWX_BushWhacker/server/types/helpers/RagfairServerHelper.d.ts b/Live/CWX_BushWhacker/server/types/helpers/RagfairServerHelper.d.ts index e4939d1..a03cdda 100644 --- a/Live/CWX_BushWhacker/server/types/helpers/RagfairServerHelper.d.ts +++ b/Live/CWX_BushWhacker/server/types/helpers/RagfairServerHelper.d.ts @@ -6,6 +6,7 @@ import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -13,6 +14,9 @@ import { RandomUtil } from "../utils/RandomUtil"; import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { ProfileHelper } from "./ProfileHelper"; +/** + * Helper class for common ragfair server actions + */ export declare class RagfairServerHelper { protected randomUtil: RandomUtil; protected hashUtil: HashUtil; @@ -23,11 +27,12 @@ export declare class RagfairServerHelper { protected localeService: LocaleService; protected dialogueHelper: DialogueHelper; protected jsonUtil: JsonUtil; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; protected static goodsReturnedTemplate: string; - constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); + constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Is item valid / on blacklist / quest item * @param itemDetails diff --git a/Live/CWX_BushWhacker/server/types/helpers/RepairHelper.d.ts b/Live/CWX_BushWhacker/server/types/helpers/RepairHelper.d.ts index 9a3ab29..5b09320 100644 --- a/Live/CWX_BushWhacker/server/types/helpers/RepairHelper.d.ts +++ b/Live/CWX_BushWhacker/server/types/helpers/RepairHelper.d.ts @@ -14,8 +14,17 @@ export declare class RepairHelper { protected configServer: ConfigServer; protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); - updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit?: boolean, applyRandomDegradation?: boolean): Item; - protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number): number; - protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, armorMax: number): number; + /** + * + * @param itemToRepair item to update durability details + * @param itemToRepairDetails db details of item to repair + * @param isArmor Is item being repaired a piece of armor + * @param amountToRepair how many unit of durability to repair + * @param useRepairKit Is item being repaired with a repair kit + * @param applyMaxDurabilityDegradation should item have max durability reduced + */ + updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit: boolean, traderQualityMultipler: number, applyMaxDurabilityDegradation?: boolean): void; + protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number, traderQualityMultipler: number): number; + protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, weaponMax: number, traderQualityMultipler: number): number; isWeaponTemplate(tpl: string): boolean; } diff --git a/Live/CWX_BushWhacker/server/types/helpers/TradeHelper.d.ts b/Live/CWX_BushWhacker/server/types/helpers/TradeHelper.d.ts index 975062b..7ab9768 100644 --- a/Live/CWX_BushWhacker/server/types/helpers/TradeHelper.d.ts +++ b/Live/CWX_BushWhacker/server/types/helpers/TradeHelper.d.ts @@ -39,6 +39,12 @@ export declare class TradeHelper { * @returns */ sellItem(pmcData: IPmcData, body: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Increment the assorts buy count by number of items purchased + * Show error on screen if player attepts 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; protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/Live/CWX_BushWhacker/server/types/helpers/TraderAssortHelper.d.ts b/Live/CWX_BushWhacker/server/types/helpers/TraderAssortHelper.d.ts index 91ba6b9..025efd6 100644 --- a/Live/CWX_BushWhacker/server/types/helpers/TraderAssortHelper.d.ts +++ b/Live/CWX_BushWhacker/server/types/helpers/TraderAssortHelper.d.ts @@ -1,7 +1,7 @@ import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator"; import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; import { Item } from "../models/eft/common/tables/IItem"; -import { ITraderAssort } from "../models/eft/common/tables/ITrader"; +import { ITrader, ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -10,13 +10,16 @@ import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; +import { TimeUtil } from "../utils/TimeUtil"; import { AssortHelper } from "./AssortHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class TraderAssortHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; protected mathUtil: MathUtil; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected assortHelper: AssortHelper; @@ -24,18 +27,32 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts + * Filter out assorts not unlocked due to level OR quest completion * @param sessionId session id - * @param traderId trader id - * @returns a traders assorts + * @param traderId traders id + * @returns a traders' assorts */ - getAssort(sessionId: string, traderId: string): ITraderAssort; + getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset a traders assorts and move nextResupply value to future + * Flag trader as needing a flea offer reset to be picked up by flea update() function + * @param trader trader details to alter + */ + resetExpiredTrader(trader: ITrader): void; + /** + * Does the supplied trader need its assorts refreshed + * @param traderID Trader to check + * @returns true they need refreshing + */ + traderAssortsHaveExpired(traderID: string): boolean; /** * Iterate over all assorts barter_scheme values, find barters selling for money and multiply by multipler in config * @param traderAssort Assorts to multiple price of diff --git a/Live/CWX_BushWhacker/server/types/helpers/TraderHelper.d.ts b/Live/CWX_BushWhacker/server/types/helpers/TraderHelper.d.ts index b2e9d38..0dc93e8 100644 --- a/Live/CWX_BushWhacker/server/types/helpers/TraderHelper.d.ts +++ b/Live/CWX_BushWhacker/server/types/helpers/TraderHelper.d.ts @@ -9,6 +9,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { PlayerService } from "../services/PlayerService"; +import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -23,9 +24,10 @@ export declare class TraderHelper { protected handbookHelper: HandbookHelper; protected playerService: PlayerService; protected fenceService: FenceService; + protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -63,7 +65,7 @@ export declare class TraderHelper { * @param item * @returns boolean */ - protected isWeaponAndBelowTraderBuyDurability(traderID: string, item: Item): boolean; + protected isWeaponBelowTraderBuyDurability(traderID: string, item: Item): boolean; /** * Get the price of an item and all of its attached children * Take into account bonuses/adjsutments e.g. discounts @@ -97,6 +99,17 @@ export declare class TraderHelper { * @param sessionID session id */ lvlUp(traderID: string, sessionID: string): void; + /** + * Get the next update timestamp for a trader + * @param traderID Trader to look up update value for + * @returns future timestamp + */ + getNextUpdateTimestamp(traderID: string): number; + /** + * Get the reset time between trader assort refreshes in seconds + * @param traderId Trader to look up + * @returns Time in seconds + */ getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader diff --git a/Live/CWX_BushWhacker/server/types/loaders/PreAkiModLoader.d.ts b/Live/CWX_BushWhacker/server/types/loaders/PreAkiModLoader.d.ts index 6ded3c6..4ab1689 100644 --- a/Live/CWX_BushWhacker/server/types/loaders/PreAkiModLoader.d.ts +++ b/Live/CWX_BushWhacker/server/types/loaders/PreAkiModLoader.d.ts @@ -33,9 +33,20 @@ export declare class PreAkiModLoader implements IModLoader { protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; /** - * - * @param mods Get an array of broken/invalid mods by name - * @returns Mod names array + * Check for duplciate mods loaded, show error if duplicate mod found + * @param modPackageData dictionary of mod package.json data + */ + protected checkForDuplicateMods(modPackageData: Record): void; + /** + * Check for and return duplicate strings inside an array + * @param stringArray Array to check for duplicates + * @returns string array of duplicates, empty if none found + */ + protected getDuplicates(stringArray: string[]): string[]; + /** + * Get an array of mods with errors that prevent them from working with SPT + * @param mods mods to validate + * @returns Mod names as array */ protected getBrokenMods(mods: string[]): string[]; /** @@ -57,7 +68,12 @@ export declare class PreAkiModLoader implements IModLoader { protected addMod(mod: string): Promise; protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record): boolean; protected isModCompatible(mod: IPackageJsonData, loadedMods: Record): boolean; - protected validMod(mod: string): boolean; + /** + * Validate a mod passes a number of checks + * @param modName name of mod in /mods/ to validate + * @returns true if valid + */ + protected validMod(modName: string): boolean; protected getLoadOrderRecursive(mod: string, result: Record, visited: Record): void; protected getLoadOrder(mods: Record): Record; getContainer(): DependencyContainer; diff --git a/Live/CWX_BushWhacker/server/types/models/eft/common/IGlobals.d.ts b/Live/CWX_BushWhacker/server/types/models/eft/common/IGlobals.d.ts index 9d28dbc..81e2023 100644 --- a/Live/CWX_BushWhacker/server/types/models/eft/common/IGlobals.d.ts +++ b/Live/CWX_BushWhacker/server/types/models/eft/common/IGlobals.d.ts @@ -1175,5 +1175,6 @@ export interface Preset { _name: string; _parent: string; _items: Item[]; + /** Default presets have this property */ _encyclopedia?: string; } diff --git a/Live/CWX_BushWhacker/server/types/models/eft/common/ILocationBase.d.ts b/Live/CWX_BushWhacker/server/types/models/eft/common/ILocationBase.d.ts index b1dd448..78ade9a 100644 --- a/Live/CWX_BushWhacker/server/types/models/eft/common/ILocationBase.d.ts +++ b/Live/CWX_BushWhacker/server/types/models/eft/common/ILocationBase.d.ts @@ -137,7 +137,7 @@ export interface BotLocationModifier { VisibleDistance: number; } export interface MinMaxBot { - WildSpawnType: string; + WildSpawnType: WildSpawnType; max: number; min: number; } @@ -195,7 +195,7 @@ export interface Wave { BotPreset: string; BotSide: string; SpawnPoints: string; - WildSpawnType: string; + WildSpawnType: WildSpawnType; isPlayers: boolean; number: number; slots_max: number; @@ -203,3 +203,7 @@ export interface Wave { time_max: number; time_min: number; } +export declare enum WildSpawnType { + ASSAULT = "assault", + MARKSMAN = "marksman" +} diff --git a/Live/CWX_BushWhacker/server/types/models/eft/common/tables/IBotBase.d.ts b/Live/CWX_BushWhacker/server/types/models/eft/common/tables/IBotBase.d.ts index 0ee468e..25cb861 100644 --- a/Live/CWX_BushWhacker/server/types/models/eft/common/tables/IBotBase.d.ts +++ b/Live/CWX_BushWhacker/server/types/models/eft/common/tables/IBotBase.d.ts @@ -28,6 +28,8 @@ export interface IBotBase { CarExtractCounts: CarExtractCounts; SurvivorClass: SurvivorClass; WishList: string[]; + /** SPT specific property used during bot generation in raid */ + sptIsPmc?: boolean; } export interface Info { EntryPoint: string; @@ -66,13 +68,13 @@ export interface IBan { dateTime: number; } export declare enum BanType { - Chat = 0, - RagFair = 1, - Voip = 2, - Trading = 3, - Online = 4, - Friends = 5, - ChangeNickname = 6 + CHAT = 0, + RAGFAIR = 1, + VOIP = 2, + TRADING = 3, + ONLINE = 4, + FRIENDS = 5, + CHANGE_NICKNAME = 6 } export interface Customization { Head: string; @@ -312,11 +314,11 @@ export interface Notes { export interface CarExtractCounts { } export declare enum SurvivorClass { - Unknown = 0, - Neutralizer = 1, - Marauder = 2, - Paramedic = 3, - Survivor = 4 + UNKNOWN = 0, + NEUTRALIZER = 1, + MARAUDER = 2, + PARAMEDIC = 3, + SURVIVOR = 4 } export interface Quest { qid: string; diff --git a/Live/CWX_BushWhacker/server/types/models/eft/common/tables/ITemplateItem.d.ts b/Live/CWX_BushWhacker/server/types/models/eft/common/tables/ITemplateItem.d.ts index 23a1a14..8569e61 100644 --- a/Live/CWX_BushWhacker/server/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/Live/CWX_BushWhacker/server/types/models/eft/common/tables/ITemplateItem.d.ts @@ -34,6 +34,7 @@ export interface Props { LootExperience?: number; ExamineExperience?: number; HideEntrails?: boolean; + InsuranceDisabled?: boolean; RepairCost?: number; RepairSpeed?: number; ExtraSizeLeft?: number; @@ -79,7 +80,7 @@ export interface Props { HasShoulderContact?: boolean; SightingRange?: number; DoubleActionAccuracyPenaltyMult?: number; - ModesCount: any; + ModesCount?: any; DurabilityBurnModificator?: number; HeatFactor?: number; CoolFactor?: number; @@ -155,7 +156,7 @@ export interface Props { RigLayoutName?: string; MaxDurability?: number; armorZone?: string[]; - armorClass: any; + armorClass?: any; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -206,6 +207,7 @@ export interface Props { IsOneoff?: boolean; MustBoltBeOpennedForExternalReload?: boolean; MustBoltBeOpennedForInternalReload?: boolean; + NoFiremodeOnBoltcatch?: boolean; BoltAction?: boolean; HipAccuracyRestorationDelay?: number; HipAccuracyRestorationSpeed?: number; @@ -252,8 +254,8 @@ export interface Props { foodUseTime?: number; foodEffectType?: string; StimulatorBuffs?: string; - effects_health: any; - effects_damage: any; + effects_health?: any; + effects_damage?: any; MaximumNumberOfUsage?: number; knifeHitDelay?: number; knifeHitSlashRate?: number; diff --git a/Live/CWX_BushWhacker/server/types/models/eft/common/tables/ITrader.d.ts b/Live/CWX_BushWhacker/server/types/models/eft/common/tables/ITrader.d.ts index f0fe2b5..37b2d61 100644 --- a/Live/CWX_BushWhacker/server/types/models/eft/common/tables/ITrader.d.ts +++ b/Live/CWX_BushWhacker/server/types/models/eft/common/tables/ITrader.d.ts @@ -7,7 +7,7 @@ export interface ITrader { suits?: ISuit[]; } export interface ITraderBase { - refreshAssort: boolean; + refreshTraderRagfairOffers: boolean; _id: string; avatar: string; balance_dol: number; @@ -58,7 +58,7 @@ export interface Repair { quality: string; } export interface ITraderAssort { - nextResupply?: number; + nextResupply: number; items: Item[]; barter_scheme: Record; loyal_level_items: Record; @@ -67,6 +67,7 @@ export interface IBarterScheme { count: number; _tpl: string; onlyFunctional?: boolean; + sptQuestLocked?: boolean; } export interface ISuit { _id: string; diff --git a/Live/CWX_BushWhacker/server/types/models/eft/health/Effect.d.ts b/Live/CWX_BushWhacker/server/types/models/eft/health/Effect.d.ts index 2f0adac..7eb3ffc 100644 --- a/Live/CWX_BushWhacker/server/types/models/eft/health/Effect.d.ts +++ b/Live/CWX_BushWhacker/server/types/models/eft/health/Effect.d.ts @@ -1,5 +1,5 @@ export declare enum Effect { - Fracture = "Fracture", - LightBleeding = "LightBleeding", - HeavyBleeding = "HeavyBleeding" + FRACTURE = "Fracture", + LIGHT_BLEEDING = "LightBleeding", + HEAVY_BLEEDING = "HeavyBleeding" } diff --git a/Live/CWX_BushWhacker/server/types/models/eft/health/IOffraidHealRequestData.d.ts b/Live/CWX_BushWhacker/server/types/models/eft/health/IOffraidHealRequestData.d.ts index c242300..26b02bd 100644 --- a/Live/CWX_BushWhacker/server/types/models/eft/health/IOffraidHealRequestData.d.ts +++ b/Live/CWX_BushWhacker/server/types/models/eft/health/IOffraidHealRequestData.d.ts @@ -7,12 +7,12 @@ export interface IOffraidHealRequestData extends IBaseInteractionRequestData { time: number; } export declare enum BodyPart { - Head = 0, - Chest = 1, - Stomach = 2, - LeftArm = 3, - RightArm = 4, - LeftLeg = 5, - RightLeg = 6, - Common = 7 + HEAD = "Head", + CHEST = "Chest", + STOMACH = "Stomach", + LEFT_ARM = "LeftArm", + RIGHT_ARM = "RightArm", + LEFT_LEG = "LeftLeg", + RIGHT_LEG = "RightLeg", + COMMON = "Common" } diff --git a/Live/CWX_BushWhacker/server/types/models/eft/notifier/INotifier.d.ts b/Live/CWX_BushWhacker/server/types/models/eft/notifier/INotifier.d.ts index 8c48260..b248636 100644 --- a/Live/CWX_BushWhacker/server/types/models/eft/notifier/INotifier.d.ts +++ b/Live/CWX_BushWhacker/server/types/models/eft/notifier/INotifier.d.ts @@ -1,9 +1,9 @@ export interface INotifierChannel { - "server": string; - "channel_id": string; - "url": string; - "notifierServer": string; - "ws": string; + server: string; + channel_id: string; + url: string; + notifierServer: string; + ws: string; } import { Message } from "../profile/IAkiProfile"; export interface INotification { diff --git a/Live/CWX_BushWhacker/server/types/models/eft/ragfair/IRagfairOffer.d.ts b/Live/CWX_BushWhacker/server/types/models/eft/ragfair/IRagfairOffer.d.ts index 63f655e..141b605 100644 --- a/Live/CWX_BushWhacker/server/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/Live/CWX_BushWhacker/server/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -15,6 +15,8 @@ export interface IRagfairOffer { name?: string; shortName?: string; loyaltyLevel: number; + buyRestrictionMax?: number; + buyRestrictionCurrent?: number; locked: boolean; unlimitedCount: boolean; summaryCost: number; diff --git a/Live/CWX_BushWhacker/server/types/models/enums/AmmoTypes.d.ts b/Live/CWX_BushWhacker/server/types/models/enums/AmmoTypes.d.ts index b52ddcf..254b410 100644 --- a/Live/CWX_BushWhacker/server/types/models/enums/AmmoTypes.d.ts +++ b/Live/CWX_BushWhacker/server/types/models/enums/AmmoTypes.d.ts @@ -23,7 +23,7 @@ export declare enum Ammo762x54 { BT_GZH = "5e023d34e8a400319a28ed44", BS_GZH = "5e023d48186a883be655e551" } -export declare enum Ammo338Lapua { +export declare enum Ammo86x70 { TAC_X = "5fc382b6d6fa9c00c571bbc3", UCW = "5fc382c1016cce60e8341b20", AP = "5fc382a9d724d907e2077dab", @@ -85,13 +85,13 @@ export declare enum Ammo9x21 { PE_GZH = "5a26ac06c4a282000c5a90a8", BT_GZH = "5a26ac0ec4a28200741e1e18" } -export declare enum Ammo357Mag { +export declare enum Ammo9x33R { FMJ = "62330b3ed4dc74626d570b95", HOLLOW_POINT = "62330bfadc5883093563729b", SOFT_POINT = "62330c40bdd19b369e1e53d1", JACKET_HP = "62330c18744e5e31df12f516" } -export declare enum Ammo45ACP { +export declare enum Ammo1143x23ACP { MATCH_FMJ = "5e81f423763d9f754677bf2e", HYDRA_SHOK = "5efb0fc6aeb21837e749c801", LASERMATCH_FMJ = "5efb0d4f4bc50b58e81710f3", @@ -126,7 +126,7 @@ export declare enum Ammo556x45 { MK_318_MOD_0_SOST = "60194943740c5d77f6705eea", SSA_AP = "601949593ae8f707c4608daa" } -export declare enum Ammo300Blackout { +export declare enum Ammo762x35 { M62_TRACER = "619636be6db0f2477964e710", BCP_FMJ = "5fbe3ffdf8b6a877a729ea82", AP = "5fd20ff893a8961fc660a954", diff --git a/Live/CWX_BushWhacker/server/types/models/enums/BaseClasses.d.ts b/Live/CWX_BushWhacker/server/types/models/enums/BaseClasses.d.ts index e733bca..36ebc71 100644 --- a/Live/CWX_BushWhacker/server/types/models/enums/BaseClasses.d.ts +++ b/Live/CWX_BushWhacker/server/types/models/enums/BaseClasses.d.ts @@ -25,6 +25,7 @@ export declare enum BaseClasses { SIGHTS = "5448fe7a4bdc2d6f028b456b", MEDS = "543be5664bdc2dd4348b4569", MONEY = "543be5dd4bdc2deb348b4569", + NIGHTVISION = "5a2c3a9486f774688b05e574", KEY = "543be5e94bdc2df1348b4568", KEY_MECHANICAL = "5c99f98d86f7745c314214b3", KEYCARD = "5c164d2286f774194c5e69fa", @@ -66,8 +67,8 @@ export declare enum BaseClasses { LUBRICANT = "57864e4c24597754843f8723", BATTERY = "57864ee62459775490116fc1", ASSAULT_SCOPE = "55818add4bdc2d5b648b456f", - REFLEX_SIGHT = "55818ad54bdc2ddc698b4569", TACTICAL_COMBO = "55818b164bdc2ddc698b456c", + FLASHLIGHT = "55818b084bdc2d5b648b4571", MAGAZINE = "5448bc234bdc2d3c308b4569", LIGHT_LASER = "55818b0e4bdc2dde698b456e", FLASH_HIDER = "550aa4bf4bdc2dd6348b456b", diff --git a/Live/CWX_BushWhacker/server/types/models/enums/BotAmount.d.ts b/Live/CWX_BushWhacker/server/types/models/enums/BotAmount.d.ts index d0e1df1..9ef9cab 100644 --- a/Live/CWX_BushWhacker/server/types/models/enums/BotAmount.d.ts +++ b/Live/CWX_BushWhacker/server/types/models/enums/BotAmount.d.ts @@ -1,7 +1,7 @@ export declare enum BotAmount { - AsOnline = "AsOnline", - Low = "Low", - Medium = "Medium", - High = "High", - Horde = "Horde" + AS_ONLINE = "AsOnline", + LOW = "Low", + MEDIUM = "Medium", + HIGH = "High", + HORDE = "Horde" } diff --git a/Live/CWX_BushWhacker/server/types/models/enums/BotDifficulty.d.ts b/Live/CWX_BushWhacker/server/types/models/enums/BotDifficulty.d.ts index c901bcf..80e45ad 100644 --- a/Live/CWX_BushWhacker/server/types/models/enums/BotDifficulty.d.ts +++ b/Live/CWX_BushWhacker/server/types/models/enums/BotDifficulty.d.ts @@ -1,8 +1,8 @@ export declare enum BotDifficulty { - AsOnline = "AsOnline", - Easy = "Easy", - Medium = "Medium", - Hard = "Hard", - Impossible = "Impossible", - Random = "Random" + AS_ONLINE = "AsOnline", + EASY = "Easy", + MEDIUM = "Medium", + HARD = "Hard", + IMPOSSIBLE = "Impossible", + RANDOM = "Random" } diff --git a/Live/CWX_BushWhacker/server/types/models/enums/ConfigTypes.d.ts b/Live/CWX_BushWhacker/server/types/models/enums/ConfigTypes.d.ts index 61d6f99..468ece5 100644 --- a/Live/CWX_BushWhacker/server/types/models/enums/ConfigTypes.d.ts +++ b/Live/CWX_BushWhacker/server/types/models/enums/ConfigTypes.d.ts @@ -8,6 +8,7 @@ export declare enum ConfigTypes { IN_RAID = "aki-inraid", INSURANCE = "aki-insurance", INVENTORY = "aki-inventory", + ITEM = "aki-item", LOCALE = "aki-locale", LOCATION = "aki-location", MATCH = "aki-match", diff --git a/Live/CWX_BushWhacker/server/types/models/enums/ELocationName.d.ts b/Live/CWX_BushWhacker/server/types/models/enums/ELocationName.d.ts index b56cc08..7ae7caa 100644 --- a/Live/CWX_BushWhacker/server/types/models/enums/ELocationName.d.ts +++ b/Live/CWX_BushWhacker/server/types/models/enums/ELocationName.d.ts @@ -1,5 +1,6 @@ export declare enum ELocationName { FACTORY_DAY = "factory4_day", + FACTORY_NIGHT = "factory4_night", BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", diff --git a/Live/CWX_BushWhacker/server/types/models/enums/MemberCategory.d.ts b/Live/CWX_BushWhacker/server/types/models/enums/MemberCategory.d.ts index 3bd9a21..a81380e 100644 --- a/Live/CWX_BushWhacker/server/types/models/enums/MemberCategory.d.ts +++ b/Live/CWX_BushWhacker/server/types/models/enums/MemberCategory.d.ts @@ -1,13 +1,13 @@ export declare enum MemberCategory { - Default = 0, - Developer = 1, - UniqueId = 2, - Trader = 4, - Group = 8, - System = 16, - ChatModerator = 32, - ChatModeratorWithPermanentBan = 64, - UnitTest = 128, - Sherpa = 256, - Emissary = 512 + DEFAULT = 0, + DEVELOPER = 1, + UNIQUE_ID = 2, + TRADER = 4, + GROUP = 8, + SYSTEM = 16, + CHAT_MODERATOR = 32, + CHAT_MODERATOR_WITH_PERMANENT_BAN = 64, + UNIT_TEST = 128, + SHERPA = 256, + EMISSARY = 512 } diff --git a/Live/CWX_BushWhacker/server/types/models/enums/QuestRewardType.d.ts b/Live/CWX_BushWhacker/server/types/models/enums/QuestRewardType.d.ts index 1d3db86..16f7e39 100644 --- a/Live/CWX_BushWhacker/server/types/models/enums/QuestRewardType.d.ts +++ b/Live/CWX_BushWhacker/server/types/models/enums/QuestRewardType.d.ts @@ -1,8 +1,8 @@ export declare enum QuestRewardType { - Skill = "Skill", - Experience = "Experience", - TraderStanding = "TraderStanding", - TraderUnlock = "TraderUnlock", - Item = "Item", - AssortmentUnlock = "AssortmentUnlock" + SKILL = "Skill", + EXPERIENCE = "Experience", + TRADER_STANDING = "TraderStanding", + TRADER_UNLOCK = "TraderUnlock", + ITEM = "Item", + ASSORTMENT_UNLOCK = "AssortmentUnlock" } diff --git a/Live/CWX_BushWhacker/server/types/models/enums/RaidMode.d.ts b/Live/CWX_BushWhacker/server/types/models/enums/RaidMode.d.ts index c5a8cff..e20cf3f 100644 --- a/Live/CWX_BushWhacker/server/types/models/enums/RaidMode.d.ts +++ b/Live/CWX_BushWhacker/server/types/models/enums/RaidMode.d.ts @@ -1,5 +1,5 @@ export declare enum RaidMode { - Online = "Online", - Local = "Local", - Coop = "Coop" + ONLINE = "Online", + LOCAL = "Local", + COOP = "Coop" } diff --git a/Live/CWX_BushWhacker/server/types/models/enums/WeaponTypes.d.ts b/Live/CWX_BushWhacker/server/types/models/enums/WeaponTypes.d.ts new file mode 100644 index 0000000..867b052 --- /dev/null +++ b/Live/CWX_BushWhacker/server/types/models/enums/WeaponTypes.d.ts @@ -0,0 +1,151 @@ +export declare enum Weapons127x55 { + ASH_12 = "5cadfbf7ae92152ac412eeef" +} +export declare enum Weapons86x70 { + MK_18 = "5fc22d7c187fea44d52eda44", + AXMC = "627e14b21713922ded6f2c15" +} +export declare enum Weapons9x39 { + AS_VAL = "57c44b372459772d2b39b8ce", + VSS_VINTOREZ = "57838ad32459774a17445cd2" +} +export declare enum Weapons762x54R { + SVDS = "5c46fbd72e2216398b5a8c9c", + MP_18 = "61f7c9e189e6fb1a5e3ea78d", + MOSIN_INFANTRY = "5bfd297f0db834001a669119", + MOSIN_SNIPER = "5ae08f0a5acfc408fb1398a1", + SV_98 = "55801eed4bdc2d89578b4588" +} +export declare enum Weapons762x51 { + VPO_101 = "5c501a4d2e221602b412b540", + DT_MDR_762 = "5dcbd56fdbd3d91b3e5468d5", + SA_58 = "5b0bbe4e5acfc40dc528a72d", + SCARH_BLACK = "6183afd850224f204c1da514", + SCARH_FDE = "6165ac306ef05c2ce828ef74", + HK_G28 = "6176aca650224f204c1da3fb", + M1A = "5aafa857e5b5b00018480968", + RFB = "5f2a9575926fd9352339381f", + RSASS = "5a367e5dc4a282000e49738f", + SR_25 = "5df8ce05b11454561e39243b", + DVL_10 = "588892092459774ac91d4b11", + M700 = "5bfea6e90db834001b7347f3", + T5000M = "5df24cf80dee1b22f862e9bc" +} +export declare enum Weapons366TKM { + VPO_209 = "59e6687d86f77411d949b251", + VPO_215 = "5de652c31b7e3716273428be" +} +export declare enum Weapons762x39 { + OP_SKS = "587e02ff24597743df3deaeb", + SKS = "574d967124597745970e7c94", + AK_103 = "5ac66d2e5acfc43b321d4b53", + AK_104 = "5ac66d725acfc43b321d4b60", + AKM = "59d6088586f774275f37482f", + AKMN = "5a0ec13bfcdbcb00165aa685", + AKMS = "59ff346386f77477562ff5e2", + AKMSN = "5abcbc27d8ce8700182eceeb", + MK47_MUTANT = "606587252535c57a13424cfd", + RD_704 = "628a60ae6b1d481ff772e9c8", + VPO_136 = "59e6152586f77473dc057aa1" +} +export declare enum Weapons762x35 { + MCX = "5fbcc1d9016cce60e8341ab3" +} +export declare enum Weapons556x45 { + ADAR_2_15 = "5c07c60e0db834002330051f", + AK_101 = "5ac66cb05acfc40198510a10", + AK_102 = "5ac66d015acfc400180ae6e4", + DT_MDR_556 = "5c488a752e221602b412af63", + HK_416A5 = "5bb2475ed4351e00853264e3", + HK_G36 = "623063e994fc3f7b302a9696", + M4A1 = "5447a9cd4bdc2dbd208b4567", + SCARL_BLACK = "6184055050224f204c1da540", + SCARL_FDE = "618428466ef05c2ce828f218", + TX15_DML = "5d43021ca4b9362eab4b5e25" +} +export declare enum Weapons545x39 { + AK_105 = "5ac66d9b5acfc4001633997a", + AK_74 = "5bf3e03b0db834001d2c4a9c", + AK_74M = "5ac4cd105acfc40016339859", + AK_74N = "5644bd2b4bdc2d3b4c8b4572", + AKS_74 = "5bf3e0490db83400196199af", + AKS_74N = "5ab8e9fcd8ce870019439434", + AKS_74U = "57dc2fa62459775949412633", + AKS_74UB = "5839a40f24597726f856b511", + AKS_74UN = "583990e32459771419544dd2", + SAG_AK = "628b5638ad252a16da6dd245", + SAG_AK_SHORT = "628b9c37a733087d0d7fe84b", + RPK_16 = "5beed0f50db834001c062b12" +} +export declare enum Weapons57x28FN { + FN_57_BLACK = "5d3eb3b0a4b93615055e84d2", + FN_57_FDE = "5d67abc1a4b93614ec50137f", + FN_P90 = "5cc82d76e24e8d00134b4b83" +} +export declare enum Weapons46x30HK { + MP7A1 = "5ba26383d4351e00334c93d9", + MP7A2 = "5bd70322209c4d00d7167b8f" +} +export declare enum Weapons1143x23 { + M1911A1 = "5e81c3cbac2bb513793cdc75", + M45A1 = "5f36a0e5fbf956000b716b65", + USP45 = "6193a720f8ee7e52e42109ed", + UMP45 = "5fc3e272f8b6a877a729eac5", + VECTOR45 = "5fb64bc92b1b027b1f50bcf2" +} +export declare enum Weapons9x33R { + CR_50DS = "61a4c8884f95bc3b2c5dc96f" +} +export declare enum Weapons9x21 { + SR_1MP = "59f98b4986f7746f546d2cef" +} +export declare enum Weapons9x19 { + GLOCK_17 = "5a7ae0c351dfba0017554310", + GLOCK_18C = "5b1fa9b25acfc40018633c01", + M9A3 = "5cadc190ae921500103bb3b6", + MP_443 = "576a581d2459771e7b1bc4f1", + P226R = "56d59856d2720bd8418b456a", + PL_15 = "602a9740da11d6478d5a06dc", + CR_200DS = "624c2e8614da335f1e034d8c", + MP5 = "5926bb2186f7744b1c6c6e60", + MP5K = "5d2f0d8048f0356c925bc3b0", + MP9 = "5e00903ae9dc277128008b87", + MP9_N = "5de7bd7bfd6b4e6e2276dc25", + MPX = "58948c8e86f77409493f7266", + PP_19_01 = "59984ab886f7743e98271174", + SAIGA_9 = "59f9cabd86f7743a10721f46", + STM_9 = "60339954d62c9b14ed777c06", + VECTOR_9MM = "5fc3f2d5900b1d5091531e57" +} +export declare enum Weapons9x18 { + APB = "5abccb7dd8ce87001773e277", + APS = "5a17f98cfcdbcb0980087290", + PB_SILENCED = "56e0598dd2720bb5668b45a6", + PM = "5448bd6b4bdc2dfc2f8b4569", + PM_T = "579204f224597773d619e051", + PP9_KLIN = "57f4c844245977379d5c14d1", + PP91_KEDR = "57d14d2524597714373db789", + PP91_KEDRB = "57f3c6bd24597738e730fa2f" +} +export declare enum Weapons762x25 { + TT = "571a12c42459771f627b58a0", + TT_GOLD = "5b3b713c5acfc4330140bd8d", + PPSH_41 = "5ea03f7400685063ec28bfa8" +} +export declare enum Weapons12Gauge { + M3_SUPER90 = "6259b864ebedf17603599e88", + M590A1 = "5e870397991fd70db46995c8", + M870 = "5a7828548dc32e5a9c28b516", + MP_133 = "54491c4f4bdc2db1078b4568", + MP_153 = "56dee2bdd2720bc8328b4567", + MP_155 = "606dae0ab0e443224b421bb7", + MP_43_1C = "5580223e4bdc2d1c128b457f", + MTS_255_12 = "60db29ce99594040e04c4a27", + SAIGA_12GA = "576165642459773c7a400233" +} +export declare enum Weapons20Gauge { + TOZ_106 = "5a38e6bac4a2826c6e06d79b" +} +export declare enum Weapons23x75 { + KS_23M = "5e848cc2988a8701445df1e8" +} diff --git a/Live/CWX_BushWhacker/server/types/models/spt/bots/BotLootCache.d.ts b/Live/CWX_BushWhacker/server/types/models/spt/bots/BotLootCache.d.ts index e185315..aedf7b0 100644 --- a/Live/CWX_BushWhacker/server/types/models/spt/bots/BotLootCache.d.ts +++ b/Live/CWX_BushWhacker/server/types/models/spt/bots/BotLootCache.d.ts @@ -11,13 +11,13 @@ export declare class BotLootCache { grenadeItems: ITemplateItem[]; } export declare enum LootCacheType { - Special = "Special", - Backpack = "Backpack", - Pocket = "Pocket", - Vest = "Vest", - Combined = "Combined", - HealingItems = "HealingItems", - DrugItems = "DrugItems", - StimItems = "StimItems", - GrenadeItems = "GrenadeItems" + SPECIAL = "Special", + BACKPACK = "Backpack", + POCKET = "Pocket", + VEST = "Vest", + COMBINED = "Combined", + HEALING_ITEMS = "HealingItems", + DRUG_ITEMS = "DrugItems", + STIM_ITEMS = "StimItems", + GRENADE_ITEMS = "GrenadeItems" } diff --git a/Live/CWX_BushWhacker/server/types/models/spt/config/IAirdropConfig.d.ts b/Live/CWX_BushWhacker/server/types/models/spt/config/IAirdropConfig.d.ts index f4aee89..3edcbdd 100644 --- a/Live/CWX_BushWhacker/server/types/models/spt/config/IAirdropConfig.d.ts +++ b/Live/CWX_BushWhacker/server/types/models/spt/config/IAirdropConfig.d.ts @@ -1,14 +1,14 @@ +import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IAirdropConfig extends IBaseConfig { kind: "aki-airdrop"; airdropChancePercent: AirdropChancePercent; - airdropMinOpenHeight: number; - airdropMaxOpenHeight: number; planeMinFlyHeight: number; planeMaxFlyHeight: number; planeVolume: number; airdropMinStartTimeSeconds: number; airdropMaxStartTimeSeconds: number; + loot: AirdropLoot; } export interface AirdropChancePercent { bigmap: number; @@ -18,3 +18,13 @@ export interface AirdropChancePercent { interchange: number; reserve: number; } +export interface AirdropLoot { + presetCount: MinMax; + itemCount: MinMax; + itemBlacklist: string[]; + itemTypeWhitelist: string[]; + /** key: item base type: value: max count */ + itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; +} diff --git a/Live/CWX_BushWhacker/server/types/models/spt/config/IBotConfig.d.ts b/Live/CWX_BushWhacker/server/types/models/spt/config/IBotConfig.d.ts index e171087..af8ceba 100644 --- a/Live/CWX_BushWhacker/server/types/models/spt/config/IBotConfig.d.ts +++ b/Live/CWX_BushWhacker/server/types/models/spt/config/IBotConfig.d.ts @@ -1,17 +1,31 @@ import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; +import { IBotDurability } from "./IBotDurability"; +import { IPmcConfig } from "./IPmcConfig"; export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; + /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** What bot types should be classified as bosses */ bosses: string[]; - durability: Durability; + /** Control weapon/armor durability min/max values for each bot type */ + durability: IBotDurability; + /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ lootNValue: LootNvalue; + /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; - pmc: PmcConfig; + /** PMC bot specific config settings */ + pmc: IPmcConfig; + /** Control how many items are allowed to spawn on a bot + * key: bottype, value: */ itemSpawnLimits: Record>; - equipment: Record; + /** Blacklist/whitelist items on a bot */ + equipment: Record; + /** Show a bots botType value after their name */ showTypeInNickname: boolean; - maxBotCap: number; + /** Max number of bots that can be spawned in a raid at any one time */ + maxBotCap: Record; + /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; } export interface PresetBatch { @@ -44,79 +58,23 @@ export interface PresetBatch { test: number; exUsec: number; } -export interface Durability { - default: DefaultDurability; - pmc: PmcDurability; - boss: BotDurability; - follower: BotDurability; - assault: BotDurability; - cursedassault: BotDurability; - marksman: BotDurability; - pmcbot: BotDurability; - exusec: BotDurability; - sectantpriest: BotDurability; - sectantwarrior: BotDurability; -} -export interface DefaultDurability { - armor: DefaultArmor; - weapon: WeaponDurability; -} -export interface DefaultArmor { - maxDelta: number; - minDelta: number; -} -export interface WeaponDurability { - lowestMax: number; - highestMax: number; - maxDelta: number; - minDelta: number; -} -export interface PmcDurability { - armor: PmcDurabilityArmor; - weapon: WeaponDurability; -} -export interface PmcDurabilityArmor { - lowestMaxPercent: number; - highestMaxPercent: number; - maxDelta: number; - minDelta: number; -} -export interface BotDurability { - armor: ArmorDurability; - weapon: WeaponDurability; -} -export interface ArmorDurability { - maxDelta: number; - minDelta: number; -} export interface LootNvalue { scav: number; pmc: number; } -export interface PmcConfig { - dynamicLoot: PmcDynamicLoot; - difficulty: string; - looseWeaponInBackpackChancePercent: number; - looseWeaponInBackpackLootMinMax: MinMax; - isUsec: number; - chanceSameSideIsHostilePercent: number; - usecType: string; - bearType: string; - maxBackpackLootTotalRub: number; - maxPocketLootTotalRub: number; - maxVestLootTotalRub: number; - convertIntoPmcChance: Record; - enemyTypes: string[]; -} -export interface PmcDynamicLoot { - whitelist: string[]; - blacklist: string[]; - moneyStackLimits: Record; -} -export interface Equipment { +export interface EquipmentFilters { + weaponModLimits: ModLimits; + randomisedWeaponModSlots?: string[]; + randomisedArmorSlots?: string[]; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; } +export interface ModLimits { + /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ + scopeLimit?: number; + /** How many lasers or lights are allowed on a weapon - hard coded to work with TACTICAL_COMBO, and FLASHLIGHT */ + lightLaserLimit?: number; +} export interface EquipmentFilterDetails { levelRange: MinMax; equipment: Record; diff --git a/Live/CWX_BushWhacker/server/types/models/spt/config/IBotDurability.d.ts b/Live/CWX_BushWhacker/server/types/models/spt/config/IBotDurability.d.ts new file mode 100644 index 0000000..38a47cc --- /dev/null +++ b/Live/CWX_BushWhacker/server/types/models/spt/config/IBotDurability.d.ts @@ -0,0 +1,47 @@ +export interface IBotDurability { + default: DefaultDurability; + pmc: PmcDurability; + boss: BotDurability; + follower: BotDurability; + assault: BotDurability; + cursedassault: BotDurability; + marksman: BotDurability; + pmcbot: BotDurability; + exusec: BotDurability; + gifter: BotDurability; + sectantpriest: BotDurability; + sectantwarrior: BotDurability; +} +/** Durability values to be used when a more specific bot type cant be found */ +export interface DefaultDurability { + armor: DefaultArmor; + weapon: WeaponDurability; +} +export interface DefaultArmor { + maxDelta: number; + minDelta: number; +} +export interface WeaponDurability { + lowestMax: number; + highestMax: number; + maxDelta: number; + minDelta: number; +} +export interface PmcDurability { + armor: PmcDurabilityArmor; + weapon: WeaponDurability; +} +export interface PmcDurabilityArmor { + lowestMaxPercent: number; + highestMaxPercent: number; + maxDelta: number; + minDelta: number; +} +export interface BotDurability { + armor: ArmorDurability; + weapon: WeaponDurability; +} +export interface ArmorDurability { + maxDelta: number; + minDelta: number; +} diff --git a/Live/CWX_BushWhacker/server/types/models/spt/config/IHideoutConfig.d.ts b/Live/CWX_BushWhacker/server/types/models/spt/config/IHideoutConfig.d.ts index 36d6246..f232052 100644 --- a/Live/CWX_BushWhacker/server/types/models/spt/config/IHideoutConfig.d.ts +++ b/Live/CWX_BushWhacker/server/types/models/spt/config/IHideoutConfig.d.ts @@ -2,6 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; runIntervalSeconds: number; - fuelDrainRateMultipler: number; hoursForSkillCrafting: number; + generatorSpeedWithoutFuel: number; + generatorFuelFlowRate: number; + airFilterUnitFlowRate: number; + /** SEE HIDEOUTHELPER BEFORE CHANGING CONFIG */ + gpuBoostRate: number; } diff --git a/Live/CWX_BushWhacker/server/types/models/spt/config/IItemConfig.d.ts b/Live/CWX_BushWhacker/server/types/models/spt/config/IItemConfig.d.ts new file mode 100644 index 0000000..5ecccc2 --- /dev/null +++ b/Live/CWX_BushWhacker/server/types/models/spt/config/IItemConfig.d.ts @@ -0,0 +1,5 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface IItemConfig extends IBaseConfig { + kind: "aki-item"; + blacklist: string[]; +} diff --git a/Live/CWX_BushWhacker/server/types/models/spt/config/IPmcConfig.d.ts b/Live/CWX_BushWhacker/server/types/models/spt/config/IPmcConfig.d.ts new file mode 100644 index 0000000..9db2ba1 --- /dev/null +++ b/Live/CWX_BushWhacker/server/types/models/spt/config/IPmcConfig.d.ts @@ -0,0 +1,26 @@ +import { MinMax } from "../../common/MinMax"; +export interface IPmcConfig { + dynamicLoot: DynamicLoot; + useDifficultyOverride: boolean; + difficulty: string; + looseWeaponInBackpackChancePercent: number; + looseWeaponInBackpackLootMinMax: MinMax; + isUsec: number; + chanceSameSideIsHostilePercent: number; + /** key: location, value: type for usec/bear */ + pmcType: Record; + maxBackpackLootTotalRub: number; + maxPocketLootTotalRub: number; + maxVestLootTotalRub: number; + convertIntoPmcChance: Record; + enemyTypes: string[]; +} +export interface PmcTypes { + usec: string; + bear: string; +} +export interface DynamicLoot { + whitelist: string[]; + blacklist: string[]; + moneyStackLimits: Record; +} diff --git a/Live/CWX_BushWhacker/server/types/models/spt/config/IQuestConfig.d.ts b/Live/CWX_BushWhacker/server/types/models/spt/config/IQuestConfig.d.ts index be4a97b..45c9aae 100644 --- a/Live/CWX_BushWhacker/server/types/models/spt/config/IQuestConfig.d.ts +++ b/Live/CWX_BushWhacker/server/types/models/spt/config/IQuestConfig.d.ts @@ -4,6 +4,8 @@ export interface IQuestConfig extends IBaseConfig { kind: "aki-quest"; redeemTime: number; repeatableQuests: IRepeatableQuestConfig[]; + bearOnlyQuests: string[]; + usecOnlyQuests: string[]; } export interface IRepeatableQuestConfig { name: string; @@ -15,6 +17,10 @@ export interface IRepeatableQuestConfig { locations: Record; traderWhitelist: ITraderWhitelist[]; questConfig: IQuestConfig; + /** Item base types to block when generating rewards */ + rewardBaseTypeBlacklist: string[]; + /** Item tplIds to ignore when generating rewards */ + rewardBlacklist: string[]; } export interface IRewardScaling { levels: number[]; diff --git a/Live/CWX_BushWhacker/server/types/models/spt/config/IRagfairConfig.d.ts b/Live/CWX_BushWhacker/server/types/models/spt/config/IRagfairConfig.d.ts index c24e617..c1b8763 100644 --- a/Live/CWX_BushWhacker/server/types/models/spt/config/IRagfairConfig.d.ts +++ b/Live/CWX_BushWhacker/server/types/models/spt/config/IRagfairConfig.d.ts @@ -12,6 +12,7 @@ export interface Sell { chance: Chance; time: Time; reputation: Reputation; + simulatedSellHours: number; } export interface Chance { base: number; @@ -27,11 +28,18 @@ export interface Reputation { gain: number; loss: number; } +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Dynamic { + offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; price: MinMax; presetPrice: MinMax; + showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; condition: Condition; stackablePercent: MinMax; diff --git a/Live/CWX_BushWhacker/server/types/models/spt/config/ITraderConfig.d.ts b/Live/CWX_BushWhacker/server/types/models/spt/config/ITraderConfig.d.ts index c8e8044..6b1c1e3 100644 --- a/Live/CWX_BushWhacker/server/types/models/spt/config/ITraderConfig.d.ts +++ b/Live/CWX_BushWhacker/server/types/models/spt/config/ITraderConfig.d.ts @@ -12,8 +12,10 @@ export interface UpdateTime { seconds: number; } export interface FenceConfig { + partialRefreshTimeSeconds: number; + partialRefreshChangePercent: number; assortSize: number; - maxPresetsCount: number; + maxPresetsPercent: number; presetPriceMult: number; blacklist: string[]; } diff --git a/Live/CWX_BushWhacker/server/types/models/spt/location/AirDropLootItem.d.ts b/Live/CWX_BushWhacker/server/types/models/spt/location/AirDropLootItem.d.ts new file mode 100644 index 0000000..da791ff --- /dev/null +++ b/Live/CWX_BushWhacker/server/types/models/spt/location/AirDropLootItem.d.ts @@ -0,0 +1,6 @@ +export declare class AirDropLootItem { + id: string; + tpl: string; + isPreset: boolean; + stackCount: number; +} diff --git a/Live/CWX_BushWhacker/server/types/models/spt/logging/LogBackgroundColor.d.ts b/Live/CWX_BushWhacker/server/types/models/spt/logging/LogBackgroundColor.d.ts index 87e08a9..1dd369b 100644 --- a/Live/CWX_BushWhacker/server/types/models/spt/logging/LogBackgroundColor.d.ts +++ b/Live/CWX_BushWhacker/server/types/models/spt/logging/LogBackgroundColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogBackgroundColor { - default = "", - black = "blackBG", - red = "redBG", - green = "greenBG", - yellow = "yellowBG", - blue = "blueBG", - magenta = "magentaBG", - cyan = "cyanBG", - white = "whiteBG" + DEFAULT = "", + BLACK = "blackBG", + RED = "redBG", + GREEN = "greenBG", + YELLOW = "yellowBG", + BLUE = "blueBG", + MAGENTA = "magentaBG", + CYAN = "cyanBG", + WHITE = "whiteBG" } diff --git a/Live/CWX_BushWhacker/server/types/models/spt/logging/LogTextColor.d.ts b/Live/CWX_BushWhacker/server/types/models/spt/logging/LogTextColor.d.ts index 7147ae3..6c7abf3 100644 --- a/Live/CWX_BushWhacker/server/types/models/spt/logging/LogTextColor.d.ts +++ b/Live/CWX_BushWhacker/server/types/models/spt/logging/LogTextColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogTextColor { - black = "black", - red = "red", - green = "green", - yellow = "yellow", - blue = "blue", - magenta = "magenta", - cyan = "cyan", - white = "white", - gray = "" + BLACK = "black", + RED = "red", + GREEN = "green", + YELLOW = "yellow", + BLUE = "blue", + MAGENTA = "magenta", + CYAN = "cyan", + WHITE = "white", + GRAY = "" } diff --git a/Live/CWX_BushWhacker/server/types/models/spt/server/ILocaleBase.d.ts b/Live/CWX_BushWhacker/server/types/models/spt/server/ILocaleBase.d.ts index 8887c06..6e20b89 100644 --- a/Live/CWX_BushWhacker/server/types/models/spt/server/ILocaleBase.d.ts +++ b/Live/CWX_BushWhacker/server/types/models/spt/server/ILocaleBase.d.ts @@ -13,10 +13,10 @@ export interface ILocaleGlobalBase { season: Record; customization: Record; repeatableQuest: Record; - templates: ILocaleTemplateBase; - locations: ILocaleLocationsBase; - banners: ILocaleBannersBase; - trading: ILocaleTradingBase; + templates: Record; + locations: Record; + banners: Record; + trading: Record; } export interface ILocaleQuest { name: string; @@ -31,23 +31,11 @@ export interface ILocaleQuest { export interface ILocalePreset { Name: string; } -export interface ILocaleTemplateBase { - templates: Record; -} -export interface ILocaleLocationsBase { - locations: Record; -} -export interface ILocaleBannersBase { - locations: Record; -} export interface ILocaleProps { Name: string; ShortName: string; Description: string; } -export interface ILocaleTradingBase { - locations: Record; -} export interface ILocaleTradingProps { FullName: string; FirstName: string; diff --git a/Live/CWX_BushWhacker/server/types/models/spt/services/LootItem.d.ts b/Live/CWX_BushWhacker/server/types/models/spt/services/LootItem.d.ts new file mode 100644 index 0000000..acb7606 --- /dev/null +++ b/Live/CWX_BushWhacker/server/types/models/spt/services/LootItem.d.ts @@ -0,0 +1,6 @@ +export declare class LootItem { + id?: string; + tpl: string; + isPreset: boolean; + stackCount: number; +} diff --git a/Live/CWX_BushWhacker/server/types/models/spt/services/LootRequest.d.ts b/Live/CWX_BushWhacker/server/types/models/spt/services/LootRequest.d.ts new file mode 100644 index 0000000..1da8770 --- /dev/null +++ b/Live/CWX_BushWhacker/server/types/models/spt/services/LootRequest.d.ts @@ -0,0 +1,11 @@ +import { MinMax } from "../../common/MinMax"; +export declare class LootRequest { + presetCount: MinMax; + itemCount: MinMax; + itemBlacklist: string[]; + itemTypeWhitelist: string[]; + /** key: item base type: value: max count */ + itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; +} diff --git a/Live/CWX_BushWhacker/server/types/servers/DatabaseServer.d.ts b/Live/CWX_BushWhacker/server/types/servers/DatabaseServer.d.ts index aa152d0..b3d29e9 100644 --- a/Live/CWX_BushWhacker/server/types/servers/DatabaseServer.d.ts +++ b/Live/CWX_BushWhacker/server/types/servers/DatabaseServer.d.ts @@ -2,5 +2,5 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; export declare class DatabaseServer { protected tableData: IDatabaseTables; getTables(): IDatabaseTables; - setTables(any: any): void; + setTables(tableData: IDatabaseTables): void; } diff --git a/Live/CWX_BushWhacker/server/types/servers/RagfairServer.d.ts b/Live/CWX_BushWhacker/server/types/servers/RagfairServer.d.ts index bc86cdb..c93864b 100644 --- a/Live/CWX_BushWhacker/server/types/servers/RagfairServer.d.ts +++ b/Live/CWX_BushWhacker/server/types/servers/RagfairServer.d.ts @@ -1,4 +1,6 @@ import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { TraderAssortHelper } from "../helpers/TraderAssortHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -12,11 +14,18 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected traderHelper: TraderHelper; + protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, configServer: ConfigServer); + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); load(): void; update(): void; + /** + * Get traders who need to be periodically refreshed + * @returns string array of traders + */ + protected getUpdateableTraders(): string[]; getAllCategories(): Record; getBespokeCategories(offers: IRagfairOffer[]): Record; /** diff --git a/Live/CWX_BushWhacker/server/types/services/BotEquipmentFilterService.d.ts b/Live/CWX_BushWhacker/server/types/services/BotEquipmentFilterService.d.ts index e49645b..632f961 100644 --- a/Live/CWX_BushWhacker/server/types/services/BotEquipmentFilterService.d.ts +++ b/Live/CWX_BushWhacker/server/types/services/BotEquipmentFilterService.d.ts @@ -1,12 +1,12 @@ import { IBotType } from "../models/eft/common/tables/IBotType"; -import { Equipment, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; protected configServer: ConfigServer; protected botConfig: IBotConfig; - protected botEquipmentFilterlists: Record; + protected botEquipmentFilterlists: Record; constructor(logger: ILogger, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig @@ -22,7 +22,7 @@ export declare class BotEquipmentFilterService { * @param playerLevel Level of the player * @returns EquipmentBlacklistDetails object */ - protected getBotEquipmentBlacklist(botRole: string, playerLevel: number): EquipmentFilterDetails; + getBotEquipmentBlacklist(botRole: string, playerLevel: number): EquipmentFilterDetails; /** * Get the whitelist for a specific bot type that's within the players level * @param botRole Bot type diff --git a/Live/CWX_BushWhacker/server/types/services/BotGenerationCacheService.d.ts b/Live/CWX_BushWhacker/server/types/services/BotGenerationCacheService.d.ts new file mode 100644 index 0000000..670c583 --- /dev/null +++ b/Live/CWX_BushWhacker/server/types/services/BotGenerationCacheService.d.ts @@ -0,0 +1,52 @@ +import { BotHelper } from "../helpers/BotHelper"; +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotGenerationCacheService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected botHelper: BotHelper; + protected storedBots: IBotBase[]; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); + /** + * Store array of bots in cache, shuffle results before storage + * @param botsToStore + */ + storeBots(botsToStore: IBotBase[]): void; + /** + * Find and return a bot based on its role + * Remove bot from internal array so it can't be retreived again + * @param role role to retreive (assault/bossTagilla etc) + * @returns IBotBase object + */ + getBot(role: string): IBotBase[]; + /** + * Find a bot by its index from cache + * @param indexOfBotToReturn index to find bot by + * @returns bot profile + */ + protected getBotFromCache(indexOfBotToReturn: number): IBotBase; + /** + * Remove bot profile by index from cache + * @param indexOfBotToReturn Index of bot profile to remove + */ + protected removeBotFromCache(indexOfBotToReturn: number): void; + /** + * Get index of bot profile that matches criteria + * @param role role of bot we want + * @param getPmc is requested bot a pmc + * @returns index of found bot + */ + protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; + /** + * Remove all cached bot profiles + */ + clearStoredBots(): void; + /** + * Does cache have bots + * @returns true if empty + */ + cacheIsEmpty(): boolean; +} diff --git a/Live/CWX_BushWhacker/server/types/services/BotLootCacheService.d.ts b/Live/CWX_BushWhacker/server/types/services/BotLootCacheService.d.ts index cc71eee..00ffb9c 100644 --- a/Live/CWX_BushWhacker/server/types/services/BotLootCacheService.d.ts +++ b/Live/CWX_BushWhacker/server/types/services/BotLootCacheService.d.ts @@ -34,6 +34,17 @@ export declare class BotLootCacheService { * @param isPmc Is the bot a PMC (alteres what loot is cached) */ protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; + /** + * Sort a pool of item objects by its flea price + * @param poolToSort pool of items to sort + */ + protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; + /** + * Add unique items into combined pool + * @param combinedItemPool Pool of items to add to + * @param itemsToAdd items to add to combined pool if unique + */ + protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; /** * Ammo/grenades have this property * @param props diff --git a/Live/CWX_BushWhacker/server/types/services/FenceService.d.ts b/Live/CWX_BushWhacker/server/types/services/FenceService.d.ts index 79058c6..23fbf52 100644 --- a/Live/CWX_BushWhacker/server/types/services/FenceService.d.ts +++ b/Live/CWX_BushWhacker/server/types/services/FenceService.d.ts @@ -11,29 +11,109 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; +import { ItemFilterService } from "./ItemFilterService"; +/** + * Handle actions surrounding Fence + * e.g. generating or refreshing assorts / get next refresh time + */ export declare class FenceService { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); + protected nextMiniRefreshTimestamp: number; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; - getFenceAssorts(): ITraderAssort; - hasExpiredCache(refreshAssort: boolean): boolean; - generateFenceAssortCache(pmcData: IPmcData): void; /** - * Get the fence level the passed in profile has + * Get assorts player can purchase + * Adjust prices based on fence level of player + * @param pmcProfile Player profile + * @returns ITraderAssort + */ + getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Get fence assorts with no price adjustments based on fence rep + * @returns ITraderAssort + */ + getRawFenceAssorts(): ITraderAssort; + /** + * Does fence need to perform a partial refresh because its passed the refresh timer defined in trader.json + * @returns true if it needs a partial refresh + */ + needsPartialRefresh(): boolean; + /** + * Replace a percentage of fence assorts with freshly generated items + */ + performPartialRefresh(): void; + /** + * Increment fence next refresh timestamp by current timestamp + partialRefreshTimeSeconds from config + */ + protected incrementPartialRefreshTime(): void; + /** + * Compare the current fence offer count to what the config wants it to be, + * If value is lower add extra count to value to generate more items to fill gap + * @param existingItemCountToReplace count of items to generate + * @returns number of items to generate + */ + protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + /** + * Choose an item (not mod) at random and remove from assorts + */ + protected removeRandomItemFromAssorts(): void; + /** + * Get an integer rounded count of items to replace based on percentrage from traderConfig value + * @param totalItemCount total item count + * @returns rounded int of items to replace + */ + protected getCountOfItemsToReplace(totalItemCount: number): number; + /** + * Get the count of items fence offers + * @returns number + */ + getOfferCount(): number; + /** + * Create a trader assort for fence + */ + generateFenceAssortCache(): void; + /** + * Create skeleton to hold assort items + * @returns ITraderAssort object + */ + protected createBaseTraderAssortItem(): ITraderAssort; + /** + * Hydrate result parameter object with generated assorts + * @param assortCount Number of assorts to generate + * @param assorts object to add assorts to + */ + protected createAssorts(assortCount: number, assorts: ITraderAssort): void; + /** + * Get the next update timestamp for fence + * @returns future timestamp + */ + getNextFenceUpdateTimestamp(): number; + /** + * Get fence refresh time in seconds + */ + protected getFenceRefreshTime(): number; + /** + * Get fence level the passed in profile has * @param pmcData Player profile - * @returns FenceLevel + * @returns FenceLevel object */ getFenceInfo(pmcData: IPmcData): FenceLevel; + /** + * Remove an assort from fence by id + * @param assortIdToRemove assort id to remove from fence assorts + */ removeFenceOffer(assortIdToRemove: string): void; - updateFenceOffers(pmcData: IPmcData): void; } diff --git a/Live/CWX_BushWhacker/server/types/services/InsuranceService.d.ts b/Live/CWX_BushWhacker/server/types/services/InsuranceService.d.ts index 171bf10..6be8a2f 100644 --- a/Live/CWX_BushWhacker/server/types/services/InsuranceService.d.ts +++ b/Live/CWX_BushWhacker/server/types/services/InsuranceService.d.ts @@ -2,6 +2,7 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { InsuredItem } from "../models/eft/common/tables/IBotBase"; import { Item } from "../models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; @@ -44,8 +45,22 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; + /** + * Store lost gear post-raid inside profile + * @param pmcData player profile to store gear in + * @param offraidData post-raid request object + * @param preRaidGear gear player wore prior to raid + * @param sessionID Session id + */ storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string): void; storeInsuredItemsForReturn(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string): void; - protected addGearToSend(pmcData: IPmcData, insuredItem: any, actualItem: any, sessionID: string): any; + /** + * Add gear item to InsuredItems array in player profile + * @param pmcData profile to store item in + * @param insuredItem Item to store in profile + * @param actualItem item to store + * @param sessionID Session id + */ + protected addGearToSend(pmcData: IPmcData, insuredItem: InsuredItem, actualItem: Item, sessionID: string): void; getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; } diff --git a/Live/CWX_BushWhacker/server/types/services/ItemFilterService.d.ts b/Live/CWX_BushWhacker/server/types/services/ItemFilterService.d.ts new file mode 100644 index 0000000..c9c8ef3 --- /dev/null +++ b/Live/CWX_BushWhacker/server/types/services/ItemFilterService.d.ts @@ -0,0 +1,24 @@ +import { IItemConfig } from "../models/spt/config/IItemConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +/** Centralise the handling of blacklisting items, uses blacklist found in config/item.json */ +export declare class ItemFilterService { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected blacklist: string[]; + protected itemConfig: IItemConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Check if the provided template id is blacklisted in config/item.json + * @param tpl template id + * @returns true if blacklisted + */ + isItemBlacklisted(tpl: string): boolean; + /** + * Return every template id blacklisted in config/item.json + * @returns string array of blacklisted tempalte ids + */ + getBlacklistedItems(): string[]; +} diff --git a/Live/CWX_BushWhacker/server/types/services/PmcAiService.d.ts b/Live/CWX_BushWhacker/server/types/services/PmcAiService.d.ts new file mode 100644 index 0000000..0690f1f --- /dev/null +++ b/Live/CWX_BushWhacker/server/types/services/PmcAiService.d.ts @@ -0,0 +1,27 @@ +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +/** Storing/retreving pmcRoles set at the start of a raid - its done at that point as we know what location the player is heading to */ +export declare class PmcAiService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + protected usecRole: string; + protected bearRole: string; + constructor(logger: ILogger, configServer: ConfigServer); + /** + * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) + * @param pmcSide eft side (usec/bear) + * @returns pmc side as defined in config + */ + getPmcRole(pmcSide: "usec" | "bear" | string): string; + /** + * Set the roles for pmcs + * @param location map location to look up and use as pmc types + */ + setPmcRolesByLocation(location: string): void; + /** + * Clear the saved role from usec/bear PMCs + */ + clearPmcRoles(): void; +} diff --git a/Live/CWX_BushWhacker/server/types/services/ProfileFixerService.d.ts b/Live/CWX_BushWhacker/server/types/services/ProfileFixerService.d.ts index ed1dec7..9cb5a38 100644 --- a/Live/CWX_BushWhacker/server/types/services/ProfileFixerService.d.ts +++ b/Live/CWX_BushWhacker/server/types/services/ProfileFixerService.d.ts @@ -45,6 +45,11 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to find and remove slots from */ protected removeResourcesFromSlotsInHideoutWithoutLocationIndexValue(pmcProfile: IPmcData): void; + /** + * Hideout slots need to be in a specific order, locationIndex in ascending order + * @param pmcProfile profile to edit + */ + protected reorderHideoutAreasWithResouceInputs(pmcProfile: IPmcData): void; /** * add in objects equal to the number of slots * @param areaType area to check diff --git a/Live/CWX_BushWhacker/server/types/services/ProfileSnapshotService.d.ts b/Live/CWX_BushWhacker/server/types/services/ProfileSnapshotService.d.ts new file mode 100644 index 0000000..445ffd0 --- /dev/null +++ b/Live/CWX_BushWhacker/server/types/services/ProfileSnapshotService.d.ts @@ -0,0 +1,30 @@ +import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { JsonUtil } from "../utils/JsonUtil"; +export declare class ProfileSnapshotService { + protected jsonUtil: JsonUtil; + protected storedProfileSnapshots: Record; + constructor(jsonUtil: JsonUtil); + /** + * Store a profile into an in-memory object + * @param sessionID session id - acts as the key + * @param profile - profile to save + */ + storeProfileSnapshot(sessionID: string, profile: IAkiProfile): void; + /** + * Retreve a stored profile + * @param sessionID key + * @returns A player profile object + */ + getProfileSnapshot(sessionID: string): IAkiProfile; + /** + * Does a profile exists against the provided key + * @param sessionID key + * @returns true if exists + */ + hasProfileSnapshot(sessionID: string): boolean; + /** + * Remove a stored profile by key + * @param sessionID key + */ + clearProfileSnapshot(sessionID: string): void; +} diff --git a/Live/CWX_BushWhacker/server/types/services/RagfairOfferService.d.ts b/Live/CWX_BushWhacker/server/types/services/RagfairOfferService.d.ts index 7398a8f..f9e3a34 100644 --- a/Live/CWX_BushWhacker/server/types/services/RagfairOfferService.d.ts +++ b/Live/CWX_BushWhacker/server/types/services/RagfairOfferService.d.ts @@ -24,7 +24,6 @@ export declare class RagfairOfferService { protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected toUpdate: Record; protected expiredOffers: Item[]; protected offers: IRagfairOffer[]; protected ragfairConfig: IRagfairConfig; @@ -38,8 +37,6 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; - setTraderUpdateStatus(traderId: string, shouldUpdate: boolean): void; - shouldTraderBeUpdated(traderID: string): boolean; getExpiredOfferCount(): number; /** * Get an array of expired items not yet processed into new offers @@ -53,12 +50,15 @@ export declare class RagfairOfferService { * @returns offer exists - true */ doesOfferExist(offerId: string): boolean; - getTraders(): Record; - flagTraderForUpdate(expiredOfferUserId: string): void; removeOfferById(offerId: string): void; removeOfferStack(offerID: string, amount: number): void; removeAllOffersByTrader(traderId: string): void; - addTradersToUpdateList(): void; + /** + * Do the trader offers on flea need to be refreshed + * @param traderID Trader to check + * @returns true if they do + */ + traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; /** diff --git a/Live/CWX_BushWhacker/server/types/services/RagfairPriceService.d.ts b/Live/CWX_BushWhacker/server/types/services/RagfairPriceService.d.ts index 679fe1d..466c9e3 100644 --- a/Live/CWX_BushWhacker/server/types/services/RagfairPriceService.d.ts +++ b/Live/CWX_BushWhacker/server/types/services/RagfairPriceService.d.ts @@ -27,6 +27,20 @@ export declare class RagfairPriceService { getDynamicPrice(itemTpl: string): number; getAllFleaPrices(): Record; getFleaPriceForItem(tplId: string): number; + /** + * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * @param itemPrice price of item + * @param itemTpl item template Id being checked + * @returns adjusted price value in roubles + */ + protected adjustPriceIfBelowHandbook(itemPrice: number, itemTpl: string): number; + /** + * Get the percentage difference between two values + * @param a numerical value a + * @param b numerical value b + * @returns different in percent + */ + protected getPriceDifference(a: number, b: number): number; getStaticPriceForItem(tplId: string): number; getBarterPrice(barterScheme: IBarterScheme[]): number; getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; diff --git a/Live/CWX_BushWhacker/server/types/services/RepairService.d.ts b/Live/CWX_BushWhacker/server/types/services/RepairService.d.ts new file mode 100644 index 0000000..3e6077c --- /dev/null +++ b/Live/CWX_BushWhacker/server/types/services/RepairService.d.ts @@ -0,0 +1,75 @@ +import { QuestHelper } from "../helpers/QuestHelper"; +import { RepairHelper } from "../helpers/RepairHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { RepairKitsInfo } from "../models/eft/repair/IRepairActionDataRequest"; +import { RepairItem } from "../models/eft/repair/ITraderRepairActionDataRequest"; +import { IRepairConfig } from "../models/spt/config/IRepairConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ItemEventRouter } from "../routers/ItemEventRouter"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { PaymentService } from "./PaymentService"; +export declare class RepairService { + protected logger: ILogger; + protected itemEventRouter: ItemEventRouter; + protected databaseServer: DatabaseServer; + protected questHelper: QuestHelper; + protected traderHelper: TraderHelper; + protected paymentService: PaymentService; + protected repairHelper: RepairHelper; + protected configServer: ConfigServer; + repairConfig: IRepairConfig; + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + /** + * Use trader to repair an items durability + * @param sessionID Session id + * @param pmcData profile to find item to repair in + * @param repairItemDetails details of the item to repair + * @param traderId Trader being used to repair item + * @returns RepairDetails object + */ + repairItemByTrader(sessionID: string, pmcData: IPmcData, repairItemDetails: RepairItem, traderId: string): RepairDetails; + /** + * + * @param sessionID Session id + * @param pmcData profile to take money from + * @param repairedItemId Repaired item id + * @param repairCost Cost to repair item in roubles + * @param traderId Id of the trader who repaired the item / who is paid + * @param output + */ + payForRepair(sessionID: string, pmcData: IPmcData, repairedItemId: string, repairCost: number, traderId: string, output: IItemEventRouterResponse): void; + /** + * Add skill points to profile after repairing an item + * @param sessionId Session id + * @param repairDetails details of item repaired, cost/item + * @param pmcData Profile to add points to + * @param output IItemEventRouterResponse + */ + addRepairSkillPoints(sessionId: string, repairDetails: RepairDetails, pmcData: IPmcData, output: IItemEventRouterResponse): void; + /** + * + * @param sessionId Session id + * @param pmcData Profile to update repaired item in + * @param repairKits Array of Repair kits to use + * @param itemToRepairId Item id to repair + * @param output IItemEventRouterResponse + * @returns Details of repair, item/price + */ + repairItemByKit(sessionId: string, pmcData: IPmcData, repairKits: RepairKitsInfo[], itemToRepairId: string, output: IItemEventRouterResponse): RepairDetails; + /** + * Update repair kits Resource object if it doesn't exist + * @param repairKitDetails Repair kit details from db + * @param repairKitInInventory Repair kit to update + */ + protected addMaxResourceToKitIfMissing(repairKitDetails: ITemplateItem, repairKitInInventory: Item): void; +} +export declare class RepairDetails { + repairCost?: number; + repairedItem: Item; + repairedItemIsArmor: boolean; +} diff --git a/Live/CWX_BushWhacker/server/types/services/TraderAssortService.d.ts b/Live/CWX_BushWhacker/server/types/services/TraderAssortService.d.ts index 5ba2d05..03b4e12 100644 --- a/Live/CWX_BushWhacker/server/types/services/TraderAssortService.d.ts +++ b/Live/CWX_BushWhacker/server/types/services/TraderAssortService.d.ts @@ -2,5 +2,10 @@ import { ITraderAssort } from "../models/eft/common/tables/ITrader"; export declare class TraderAssortService { protected pristineTraderAssorts: Record; getPristineTraderAssort(traderId: string): ITraderAssort; + /** + * Store trader assorts inside a class property + * @param traderId Traderid to store assorts against + * @param assort Assorts to store + */ setPristineTraderAssort(traderId: string, assort: ITraderAssort): void; } diff --git a/Live/CWX_BushWhacker/server/types/utils/HashUtil.d.ts b/Live/CWX_BushWhacker/server/types/utils/HashUtil.d.ts index bacbf2a..a8500e1 100644 --- a/Live/CWX_BushWhacker/server/types/utils/HashUtil.d.ts +++ b/Live/CWX_BushWhacker/server/types/utils/HashUtil.d.ts @@ -4,8 +4,18 @@ import { TimeUtil } from "./TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; constructor(timeUtil: TimeUtil); + /** + * Create a 24 character id using the sha256 algorithm + current timestamp + * @returns 24 character hash + */ generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + /** + * Create a hash for the data parameter + * @param algorithm algorithm to use to hash + * @param data data to be hashed + * @returns hash value + */ generateHashForData(algorithm: string, data: crypto.BinaryLike): string; } diff --git a/Live/CWX_BushWhacker/server/types/utils/RandomUtil.d.ts b/Live/CWX_BushWhacker/server/types/utils/RandomUtil.d.ts index c24dd60..633e472 100644 --- a/Live/CWX_BushWhacker/server/types/utils/RandomUtil.d.ts +++ b/Live/CWX_BushWhacker/server/types/utils/RandomUtil.d.ts @@ -136,7 +136,7 @@ export declare class RandomUtil { * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with ot without replacement from the input array + * @param {boolean} replacement Draw with or without replacement from the input array * @return {array} Array consisting of N random elements */ drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; @@ -150,4 +150,10 @@ export declare class RandomUtil { */ drawRandomFromDict(dict: any, count?: number, replacement?: boolean): any[]; getBiasedRandomNumber(min: number, max: number, shift: number, n: number): number; + /** + * Fisher-Yates shuffle an array + * @param array Array to shuffle + * @returns Shuffled array + */ + shuffle(array: Array): Array; } diff --git a/Live/CWX_BushWhacker/server/types/utils/TimeUtil.d.ts b/Live/CWX_BushWhacker/server/types/utils/TimeUtil.d.ts index eed4e6d..1367e26 100644 --- a/Live/CWX_BushWhacker/server/types/utils/TimeUtil.d.ts +++ b/Live/CWX_BushWhacker/server/types/utils/TimeUtil.d.ts @@ -1,9 +1,16 @@ +/** + * Utility class to handle time related problems + */ export declare class TimeUtil { static readonly oneHourAsSeconds = 3600; formatTime(date: Date): string; formatDate(date: Date): string; getDate(): string; getTime(): string; + /** + * Get timestamp in seconds + * @returns + */ getTimestamp(): number; /** * mail in eft requires time be in a specific format @@ -15,4 +22,10 @@ export declare class TimeUtil { * @returns current date in format: 00.00.0000 (dd.mm.yyyy) */ getDateMailFormat(): string; + /** + * Convert hours into seconds + * @param hours hours to convert to seconds + * @returns number + */ + getHoursAsSeconds(hours: number): number; } diff --git a/Live/CWX_DeSharpener/CWX-DeSharpener 1.4.3/bepInEx/plugins/CWX-DeSharpener.dll b/Live/CWX_DeSharpener/CWX-DeSharpener 1.4.4/bepInEx/plugins/CWX-DeSharpener.dll similarity index 67% rename from Live/CWX_DeSharpener/CWX-DeSharpener 1.4.3/bepInEx/plugins/CWX-DeSharpener.dll rename to Live/CWX_DeSharpener/CWX-DeSharpener 1.4.4/bepInEx/plugins/CWX-DeSharpener.dll index efc8b64..da29c58 100644 Binary files a/Live/CWX_DeSharpener/CWX-DeSharpener 1.4.3/bepInEx/plugins/CWX-DeSharpener.dll and b/Live/CWX_DeSharpener/CWX-DeSharpener 1.4.4/bepInEx/plugins/CWX-DeSharpener.dll differ diff --git a/Live/CWX_DeSharpener/CWX-DeSharpener 1.4.3/user/mods/CWX-DeSharpener 1.4.3/LICENSE.txt b/Live/CWX_DeSharpener/CWX-DeSharpener 1.4.4/user/mods/CWX-DeSharpener 1.4.4/LICENSE.txt similarity index 100% rename from Live/CWX_DeSharpener/CWX-DeSharpener 1.4.3/user/mods/CWX-DeSharpener 1.4.3/LICENSE.txt rename to Live/CWX_DeSharpener/CWX-DeSharpener 1.4.4/user/mods/CWX-DeSharpener 1.4.4/LICENSE.txt diff --git a/Live/CWX_DeSharpener/CWX-DeSharpener 1.4.3/user/mods/CWX-DeSharpener 1.4.3/package.json b/Live/CWX_DeSharpener/CWX-DeSharpener 1.4.4/user/mods/CWX-DeSharpener 1.4.4/package.json similarity index 95% rename from Live/CWX_DeSharpener/CWX-DeSharpener 1.4.3/user/mods/CWX-DeSharpener 1.4.3/package.json rename to Live/CWX_DeSharpener/CWX-DeSharpener 1.4.4/user/mods/CWX-DeSharpener 1.4.4/package.json index 4dd9752..79e57da 100644 --- a/Live/CWX_DeSharpener/CWX-DeSharpener 1.4.3/user/mods/CWX-DeSharpener 1.4.3/package.json +++ b/Live/CWX_DeSharpener/CWX-DeSharpener 1.4.4/user/mods/CWX-DeSharpener 1.4.4/package.json @@ -1,10 +1,10 @@ { "name": "DeSharpener", "author": "CWX", - "version": "1.4.3", + "version": "1.4.4", "license": "NCSA", "main": "src/mod.js", - "akiVersion": "3.2.2", + "akiVersion": "3.2.3", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" ./**/*.* ./dist", diff --git a/Live/CWX_DeSharpener/CWX-DeSharpener 1.4.3/user/mods/CWX-DeSharpener 1.4.3/src/mod.ts b/Live/CWX_DeSharpener/CWX-DeSharpener 1.4.4/user/mods/CWX-DeSharpener 1.4.4/src/mod.ts similarity index 100% rename from Live/CWX_DeSharpener/CWX-DeSharpener 1.4.3/user/mods/CWX-DeSharpener 1.4.3/src/mod.ts rename to Live/CWX_DeSharpener/CWX-DeSharpener 1.4.4/user/mods/CWX-DeSharpener 1.4.4/src/mod.ts diff --git a/Live/CWX_DeSharpener/CWX_DeSharpener.csproj b/Live/CWX_DeSharpener/CWX_DeSharpener.csproj index 660798c..3184092 100644 --- a/Live/CWX_DeSharpener/CWX_DeSharpener.csproj +++ b/Live/CWX_DeSharpener/CWX_DeSharpener.csproj @@ -2,7 +2,7 @@ net472 - 1.4.0 + 1.4.4 CWX-DeSharpener diff --git a/Live/CWX_DeSharpener/Program.cs b/Live/CWX_DeSharpener/Program.cs index 8b93382..6f8b64a 100644 --- a/Live/CWX_DeSharpener/Program.cs +++ b/Live/CWX_DeSharpener/Program.cs @@ -3,7 +3,7 @@ using BepInEx.Configuration; namespace DeSharpener { - [BepInPlugin("com.CWX.DeSharpener", "CWX-DeSharpener", "1.4.0")] + [BepInPlugin("com.CWX.DeSharpener", "CWX-DeSharpener", "1.4.4")] public class Plugin : BaseUnityPlugin { private void Awake() diff --git a/Live/CWX_DeSharpener/README.md b/Live/CWX_DeSharpener/README.md index 66a98bb..f632827 100644 --- a/Live/CWX_DeSharpener/README.md +++ b/Live/CWX_DeSharpener/README.md @@ -1,5 +1,5 @@ # DeSharpener ## CWX-DESHARPENER for EFT - SPT-AKI -### CURRENT AKI VERSION: 2.3.0 -### GAMEVERSION: 0.12.12.16909 +### CURRENT AKI VERSION: 3.2.3 +### GAMEVERSION: 0.12.12.31.19428 ### USING BEPINEX diff --git a/Live/CWX_DeSharpener/server/dist/package.json b/Live/CWX_DeSharpener/server/dist/package.json index 4dd9752..79e57da 100644 --- a/Live/CWX_DeSharpener/server/dist/package.json +++ b/Live/CWX_DeSharpener/server/dist/package.json @@ -1,10 +1,10 @@ { "name": "DeSharpener", "author": "CWX", - "version": "1.4.3", + "version": "1.4.4", "license": "NCSA", "main": "src/mod.js", - "akiVersion": "3.2.2", + "akiVersion": "3.2.3", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" ./**/*.* ./dist", diff --git a/Live/CWX_DeSharpener/server/dist/types/callbacks/InsuranceCallbacks.d.ts b/Live/CWX_DeSharpener/server/dist/types/callbacks/InsuranceCallbacks.d.ts index 6819960..8835ba2 100644 --- a/Live/CWX_DeSharpener/server/dist/types/callbacks/InsuranceCallbacks.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/callbacks/InsuranceCallbacks.d.ts @@ -1,5 +1,5 @@ import { InsuranceController } from "../controllers/InsuranceController"; -import { OnLoadOnUpdate } from "../di/OnLoadOnUpdate"; +import { OnUpdate } from "../di/OnUpdate"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData"; @@ -10,14 +10,13 @@ import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { InsuranceService } from "../services/InsuranceService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -export declare class InsuranceCallbacks extends OnLoadOnUpdate { +export declare class InsuranceCallbacks extends OnUpdate { protected insuranceController: InsuranceController; protected insuranceService: InsuranceService; protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); - onLoad(): void; getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; diff --git a/Live/CWX_DeSharpener/server/dist/types/callbacks/LocationCallbacks.d.ts b/Live/CWX_DeSharpener/server/dist/types/callbacks/LocationCallbacks.d.ts index cc69369..6e0b538 100644 --- a/Live/CWX_DeSharpener/server/dist/types/callbacks/LocationCallbacks.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/callbacks/LocationCallbacks.d.ts @@ -11,4 +11,5 @@ export declare class LocationCallbacks { constructor(httpResponse: HttpResponseUtil, locationController: LocationController); getLocationData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocation(url: string, info: IGetLocationRequestData, sessionID: string): IGetBodyResponseData; + getAirdropLoot(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/Live/CWX_DeSharpener/server/dist/types/callbacks/ProfileCallbacks.d.ts b/Live/CWX_DeSharpener/server/dist/types/callbacks/ProfileCallbacks.d.ts index 6a86fc0..183bb0a 100644 --- a/Live/CWX_DeSharpener/server/dist/types/callbacks/ProfileCallbacks.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/callbacks/ProfileCallbacks.d.ts @@ -1,5 +1,6 @@ import { ProfileController } from "../controllers/ProfileController"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IGetMiniProfileRequestData } from "../models/eft/launcher/IGetMiniProfileRequestData"; @@ -12,20 +13,51 @@ import { ISearchFriendResponse } from "../models/eft/profile/ISearchFriendRespon import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** Handle profile related client events */ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); createProfile(url: string, info: IProfileCreateRequestData, sessionID: string): IGetBodyResponseData; - getProfileData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - regenerateScav(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Get the complete player profile (scav + pmc character) + * @param url + * @param info Empty + * @param sessionID Session id + * @returns Profile object + */ + getProfileData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle the creation of a scav profile for player + * Occurs post-raid and when profile first created immediately after character details are confirmed by player + * @param url + * @param info empty + * @param sessionID Session id + * @returns Profile object + */ + regenerateScav(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/profile/voice/change event + * @param url + * @param info Change voice request object + * @param sessionID Session id + * @returns Client response + */ changeVoice(url: string, info: IProfileChangeVoiceRequestData, sessionID: string): INullResponseData; + /** + * Handle client/game/profile/nickname/change event + * Client allows player to adjust their profile name + * @param url + * @param info Change nickname request object + * @param sessionID Session id + * @returns client response + */ changeNickname(url: string, info: IProfileChangeNicknameRequestData, sessionID: string): IGetBodyResponseData; validateNickname(url: string, info: IValidateNicknameRequestData, sessionID: string): IGetBodyResponseData; getReservedNickname(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** - * Called when creating a character, when you choose a character face/voice + * Called when creating a character when choosing a character face/voice * @param url * @param info response (empty) * @param sessionID diff --git a/Live/CWX_DeSharpener/server/dist/types/callbacks/RagfairCallbacks.d.ts b/Live/CWX_DeSharpener/server/dist/types/callbacks/RagfairCallbacks.d.ts index 3a405c9..c609f2f 100644 --- a/Live/CWX_DeSharpener/server/dist/types/callbacks/RagfairCallbacks.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/callbacks/RagfairCallbacks.d.ts @@ -19,6 +19,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; +/** + * Handle ragfair related callback events + */ export declare class RagfairCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; protected logger: ILogger; diff --git a/Live/CWX_DeSharpener/server/dist/types/callbacks/RepairCallbacks.d.ts b/Live/CWX_DeSharpener/server/dist/types/callbacks/RepairCallbacks.d.ts index 63733fa..14edeeb 100644 --- a/Live/CWX_DeSharpener/server/dist/types/callbacks/RepairCallbacks.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/callbacks/RepairCallbacks.d.ts @@ -6,6 +6,20 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa export declare class RepairCallbacks { protected repairController: RepairController; constructor(repairController: RepairController); + /** + * use trader to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + /** + * Use repair kit to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ repair(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/Live/CWX_DeSharpener/server/dist/types/callbacks/TraderCallbacks.d.ts b/Live/CWX_DeSharpener/server/dist/types/callbacks/TraderCallbacks.d.ts index 128d9b2..e4fd099 100644 --- a/Live/CWX_DeSharpener/server/dist/types/callbacks/TraderCallbacks.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/callbacks/TraderCallbacks.d.ts @@ -9,10 +9,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); onLoad(): void; + onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - onUpdate(): boolean; } diff --git a/Live/CWX_DeSharpener/server/dist/types/context/ContextVariable.d.ts b/Live/CWX_DeSharpener/server/dist/types/context/ContextVariable.d.ts index e438947..0fe0a63 100644 --- a/Live/CWX_DeSharpener/server/dist/types/context/ContextVariable.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/context/ContextVariable.d.ts @@ -4,7 +4,7 @@ export declare class ContextVariable { private timestamp; private type; constructor(value: any, type: ContextVariableType); - getValue(): any; + getValue(): T; getTimestamp(): Date; getType(): ContextVariableType; } diff --git a/Live/CWX_DeSharpener/server/dist/types/controllers/BotController.d.ts b/Live/CWX_DeSharpener/server/dist/types/controllers/BotController.d.ts index 5e6f05d..a5111d5 100644 --- a/Live/CWX_DeSharpener/server/dist/types/controllers/BotController.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/controllers/BotController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotHelper } from "../helpers/BotHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; @@ -5,15 +6,22 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { IBotCore } from "../models/eft/common/tables/IBotCore"; import { Difficulty } from "../models/eft/common/tables/IBotType"; import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; +import { PmcAiService } from "../services/PmcAiService"; export declare class BotController { + protected logger: ILogger; protected databaseServer: DatabaseServer; protected botGenerator: BotGenerator; protected botHelper: BotHelper; + protected pmcAiService: PmcAiService; + protected botGenerationCacheService: BotGenerationCacheService; protected configServer: ConfigServer; + protected applicationContext: ApplicationContext; protected botConfig: IBotConfig; - constructor(databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -29,7 +37,18 @@ export declare class BotController { * @returns Difficulty object */ getBotDifficulty(type: string, difficulty: string): Difficulty; - protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string): Difficulty; + protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Generate bot profiles and store in cache + * @param sessionId Session id + * @param info bot generation request info + * @returns IBotBase array + */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the max number of bots allowed on a map + * Looks up location player is entering when getting cap value + * @returns cap number + */ getBotCap(): number; } diff --git a/Live/CWX_DeSharpener/server/dist/types/controllers/GameController.d.ts b/Live/CWX_DeSharpener/server/dist/types/controllers/GameController.d.ts index 85ec418..2d00898 100644 --- a/Live/CWX_DeSharpener/server/dist/types/controllers/GameController.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/controllers/GameController.d.ts @@ -7,11 +7,13 @@ import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; protected localeService: LocaleService; @@ -20,9 +22,14 @@ export declare class GameController { protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + /** + * Make non-trigger-spawned raiders spawn earlier + always + */ + protected adjustLabsRaiderSpawnRate(): void; protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; + getValidGameVersion(): any; } diff --git a/Live/CWX_DeSharpener/server/dist/types/controllers/HideoutController.d.ts b/Live/CWX_DeSharpener/server/dist/types/controllers/HideoutController.d.ts index 3eefe1a..dcd8894 100644 --- a/Live/CWX_DeSharpener/server/dist/types/controllers/HideoutController.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/controllers/HideoutController.d.ts @@ -28,6 +28,7 @@ import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,9 +46,10 @@ export declare class HideoutController { protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/Live/CWX_DeSharpener/server/dist/types/controllers/InraidController.d.ts b/Live/CWX_DeSharpener/server/dist/types/controllers/InraidController.d.ts index b899e7d..102a2fb 100644 --- a/Live/CWX_DeSharpener/server/dist/types/controllers/InraidController.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/controllers/InraidController.d.ts @@ -5,9 +5,11 @@ import { ItemHelper } from "../helpers/ItemHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; @@ -15,6 +17,7 @@ import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class InraidController { + protected logger: ILogger; protected saveServer: SaveServer; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; @@ -29,16 +32,40 @@ export declare class InraidController { protected inRaidHelper: InRaidHelper; protected configServer: ConfigServer; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Handle updating the profile post-pmc raid + * @param sessionID session id + * @param offraidData post-raid data of raid + */ + protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Reduce body part hp to % of max + * @param pmcData profile to edit + * @param multipler multipler to apply to max health + */ + protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + /** + * Handle updating the profile post-pscav raid + * @param sessionID session id + * @param offraidData post-raid data of raid + */ + protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Is the player dead after a raid - dead is anything other than "survived" / "runner" + * @param statusOnExit exit value from offraidData object + * @returns true if dead + */ + protected isPlayerDead(statusOnExit: string): boolean; /** * Mark inventory items as FiR if player survived raid, otherwise remove FiR from them * @param offraidData Save Progress Request * @param pmcData player profile * @param isPlayerScav Was the player a pScav */ - private markOrRemoveFoundInRaidItems; - private handlePostRaidPlayerScavProcess; - private handlePostRaidPlayerScavKarmaChanges; + protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; } diff --git a/Live/CWX_DeSharpener/server/dist/types/controllers/InventoryController.d.ts b/Live/CWX_DeSharpener/server/dist/types/controllers/InventoryController.d.ts index f57f731..f564919 100644 --- a/Live/CWX_DeSharpener/server/dist/types/controllers/InventoryController.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/controllers/InventoryController.d.ts @@ -92,7 +92,11 @@ export declare class InventoryController { */ toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; /** - * Handles Tagging of items (primary Containers). + * Add a tag to an inventory item + * @param pmcData profile with item to add tag to + * @param body tag request data + * @param sessionID session id + * @returns client response object */ tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/Live/CWX_DeSharpener/server/dist/types/controllers/LocationController.d.ts b/Live/CWX_DeSharpener/server/dist/types/controllers/LocationController.d.ts index 90b6d7a..9db3205 100644 --- a/Live/CWX_DeSharpener/server/dist/types/controllers/LocationController.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/controllers/LocationController.d.ts @@ -1,18 +1,33 @@ import { LocationGenerator } from "../generators/LocationGenerator"; +import { LootGenerator } from "../generators/LootGenerator"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; +import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; +import { LootItem } from "../models/spt/services/LootItem"; import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class LocationController { protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected logger: ILogger; protected locationGenerator: LocationGenerator; + protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; - constructor(jsonUtil: JsonUtil, logger: ILogger, locationGenerator: LocationGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil); + protected configServer: ConfigServer; + protected airdropConfig: IAirdropConfig; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; generateAll(): ILocationsGenerateAllResponse; + /** + * Get loot for an airdop container + * Generates it randomly based on config/airdrop.json values + * @returns Array of LootItem + */ + getAirdropLoot(): LootItem[]; } diff --git a/Live/CWX_DeSharpener/server/dist/types/controllers/MatchController.d.ts b/Live/CWX_DeSharpener/server/dist/types/controllers/MatchController.d.ts index 71cb7d3..07f6a89 100644 --- a/Live/CWX_DeSharpener/server/dist/types/controllers/MatchController.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/controllers/MatchController.d.ts @@ -9,23 +9,33 @@ import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestDa import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; +import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { PmcAiService } from "../services/PmcAiService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { + protected logger: ILogger; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected matchLocationService: MatchLocationService; protected traderHelper: TraderHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; + protected profileSnapshotService: ProfileSnapshotService; + protected pmcAiService: PmcAiService; + protected botGenerationCacheService: BotGenerationCacheService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + protected botConfig: IBotConfig; + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/Live/CWX_DeSharpener/server/dist/types/controllers/QuestController.d.ts b/Live/CWX_DeSharpener/server/dist/types/controllers/QuestController.d.ts index 2cbccfb..282f50e 100644 --- a/Live/CWX_DeSharpener/server/dist/types/controllers/QuestController.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/controllers/QuestController.d.ts @@ -39,16 +39,31 @@ export declare class QuestController { * @returns array of IQuest */ getClientQuests(sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param side player side (usec/bear) + * @param questId questId to check + */ + protected questIsForOtherSide(side: string, questId: string): boolean; + /** + * Handle the client accepting a quest and starting it + * Send starting rewards if any to player and + * Send start notification if any to player + * @param pmcData Profile to update + * @param acceptedQuest Quest accepted + * @param sessionID Session id + * @returns client response + */ acceptQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; acceptRepeatableQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; /** - * Remove completed quest from profile + * Update completed quest in profile * Add newly unlocked quests to profile * Also recalculate thier level due to exp rewards * @param pmcData Player profile - * @param body completed quest request - * @param sessionID session id - * @returns ItemEvent response + * @param body Completed quest request + * @param sessionID Session id + * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -67,10 +82,20 @@ export declare class QuestController { protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the quests provided + * Update quest in profile, otherwise add fresh quest object with failed status * @param sessionID session id * @param pmcData player profile * @param questsToFail quests to fail */ protected failQuests(sessionID: string, pmcData: IPmcData, questsToFail: IQuest[]): void; handoverQuest(pmcData: IPmcData, body: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Increment a backend counter stored value by an amount, + * Create counter if it does not exist + * @param pmcData Profile to find backend counter in + * @param conditionId backend counter id to update + * @param questId quest id counter is associated with + * @param counterValue value to increment the backend counter with + */ + protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; } diff --git a/Live/CWX_DeSharpener/server/dist/types/controllers/RagfairController.d.ts b/Live/CWX_DeSharpener/server/dist/types/controllers/RagfairController.d.ts index c4ffc15..06af740 100644 --- a/Live/CWX_DeSharpener/server/dist/types/controllers/RagfairController.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/controllers/RagfairController.d.ts @@ -9,6 +9,7 @@ import { RagfairOfferHelper } from "../helpers/RagfairOfferHelper"; import { RagfairSellHelper } from "../helpers/RagfairSellHelper"; import { RagfairSortHelper } from "../helpers/RagfairSortHelper"; import { RagfairTaxHelper } from "../helpers/RagfairTaxHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; @@ -33,6 +34,9 @@ import { RagfairPriceService } from "../services/RagfairPriceService"; import { RagfairRequiredItemsService } from "../services/RagfairRequiredItemsService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** + * Handle RagfairCallback events + */ export declare class RagfairController { protected logger: ILogger; protected timeUtil: TimeUtil; @@ -52,14 +56,20 @@ export declare class RagfairController { protected handbookHelper: HandbookHelper; protected paymentHelper: PaymentHelper; protected inventoryHelper: InventoryHelper; + protected traderHelper: TraderHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected ragfairOfferGenerator: RagfairOfferGenerator; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + /** + * Update a trader flea offer with buy restrictions stored in the traders assort + * @param offer flea offer to update + */ + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer): void; protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; diff --git a/Live/CWX_DeSharpener/server/dist/types/controllers/RepairController.d.ts b/Live/CWX_DeSharpener/server/dist/types/controllers/RepairController.d.ts index 0e78ef6..ae54a53 100644 --- a/Live/CWX_DeSharpener/server/dist/types/controllers/RepairController.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/controllers/RepairController.d.ts @@ -8,9 +8,9 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa import { IRepairConfig } from "../models/spt/config/IRepairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; -import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { PaymentService } from "../services/PaymentService"; +import { RepairService } from "../services/RepairService"; export declare class RepairController { protected logger: ILogger; protected itemEventRouter: ItemEventRouter; @@ -19,23 +19,23 @@ export declare class RepairController { protected traderHelper: TraderHelper; protected paymentService: PaymentService; protected repairHelper: RepairHelper; - protected configServer: ConfigServer; + protected repairService: RepairService; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); /** * Repair with trader - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + traderRepair(sessionID: string, body: ITraderRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; /** * Repair with repair kit - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - repairWithKit(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + repairWithKit(sessionID: string, body: IRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; } diff --git a/Live/CWX_DeSharpener/server/dist/types/controllers/RepeatableQuestController.d.ts b/Live/CWX_DeSharpener/server/dist/types/controllers/RepeatableQuestController.d.ts index 98d05dd..4c31a3d 100644 --- a/Live/CWX_DeSharpener/server/dist/types/controllers/RepeatableQuestController.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/controllers/RepeatableQuestController.d.ts @@ -7,6 +7,7 @@ import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; import { TraderInfo } from "../models/eft/common/tables/IBotBase"; import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; import { ELocationName } from "../models/enums/ELocationName"; @@ -15,6 +16,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -64,9 +66,10 @@ export declare class RepeatableQuestController { protected itemEventRouter: ItemEventRouter; protected paymentService: PaymentService; protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. @@ -217,4 +220,16 @@ export declare class RepeatableQuestController { debugLogRepeatableQuestIds(pmcData: IPmcData): void; probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; changeRepeatableQuest(pmcDataIn: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {*} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; } diff --git a/Live/CWX_DeSharpener/server/dist/types/controllers/TraderController.d.ts b/Live/CWX_DeSharpener/server/dist/types/controllers/TraderController.d.ts index 7bab158..b79f55e 100644 --- a/Live/CWX_DeSharpener/server/dist/types/controllers/TraderController.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/controllers/TraderController.d.ts @@ -4,6 +4,7 @@ import { TraderHelper } from "../helpers/TraderHelper"; import { IBarterScheme, ITraderAssort, ITraderBase } from "../models/eft/common/tables/ITrader"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -15,12 +16,29 @@ export declare class TraderController { protected traderHelper: TraderHelper; protected timeUtil: TimeUtil; protected traderAssortService: TraderAssortService; + protected fenceService: FenceService; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, fenceService: FenceService, jsonUtil: JsonUtil); + /** + * Runs when onLoad event is fired + * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Store timestamp of next assort refresh in nextResupply property of traders .base object + */ load(): void; - getTrader(traderID: string, sessionID: string): ITraderBase; + /** + * Runs when onUpdate is fired + * If current time is > nextResupply(expire) time of trader, refresh traders assorts and + * Fence is handled slightly differently + * @returns has run + */ + update(): boolean; + /** + * Return an array of all traders + * @param sessionID Session id + * @returns array if ITraderBase objects + */ getAllTraders(sessionID: string): ITraderBase[]; - updateTraders(): boolean; + getTrader(sessionID: string, traderID: string): ITraderBase; getAssort(sessionId: string, traderId: string): ITraderAssort; - getPurchasesData(traderID: string, sessionID: string): Record; + getPurchasesData(sessionID: string, traderID: string): Record; } diff --git a/Live/CWX_DeSharpener/server/dist/types/di/Container.d.ts b/Live/CWX_DeSharpener/server/dist/types/di/Container.d.ts index 17791b0..98d1fa1 100644 --- a/Live/CWX_DeSharpener/server/dist/types/di/Container.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/di/Container.d.ts @@ -1,4 +1,7 @@ import { DependencyContainer } from "tsyringe"; +/** + * Handle the registration of classes to be used by the Dependency Injection code + */ export declare class Container { static registerTypes(depContainer: DependencyContainer): void; static registerListTypes(depContainer: DependencyContainer): void; diff --git a/Live/CWX_DeSharpener/server/dist/types/generators/BotGenerator.d.ts b/Live/CWX_DeSharpener/server/dist/types/generators/BotGenerator.d.ts index a5fc0ad..2ac51db 100644 --- a/Live/CWX_DeSharpener/server/dist/types/generators/BotGenerator.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/generators/BotGenerator.d.ts @@ -9,6 +9,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { PmcAiService } from "../services/PmcAiService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -30,9 +31,10 @@ export declare class BotGenerator { protected botEquipmentFilterService: BotEquipmentFilterService; protected botHelper: BotHelper; protected gameEventHelper: GameEventHelper; + protected pmcAiService: PmcAiService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, pmcAiService: PmcAiService, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -40,14 +42,14 @@ export declare class BotGenerator { * @param botTemplate base bot template to use (e.g. assault/pmcbot) * @returns */ - generatePlayerScav(role: string, difficulty: string, botTemplate: IBotType): IBotBase; - generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Choose if a bot should become a PMC by checking if bot type is allowed to become a Pmc in botConfig.convertFromChances and doing a random int check - * @param botRole the bot role to check if should be a pmc - * @returns true if should be a pmc + * Generate an array of bot objects for populate a raid with + * @param sessionId session id + * @param info request object + * @returns bot array */ - protected shouldBotBePmc(botRole: string): boolean; + generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** * Get a randomised PMC side based on bot config value 'isUsec' * @returns pmc side as string @@ -58,12 +60,30 @@ export declare class BotGenerator { * @returns IBotBase object */ protected getCloneOfBotBase(): IBotBase; - protected generateBot(bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + /** + * Create a IBotBase object with equipment/loot/exp etc + * @param sessionId Session id + * @param bot bots base file + * @param role botRole bot will use + * @param node Bot template from db/bots/x.json + * @param isPmc Is bot to be a PMC + * @param isPlayerScav is bot to be a p scav bot + * @returns IBotBase object + */ + protected generateBot(sessionId: string, bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; /** * Log the number of PMCs generated to the debug console + * @param output Generated bot array, ready to send to client */ protected logPmcGeneratedCount(output: IBotBase[]): void; - protected generateRandomLevel(min: number, max: number): BotGenerator.IRandomisedBotLevelResult; + /** + * Return a randomised bot level and exp value + * @param role botRole being generated for + * @param min Min exp value + * @param max Max exp value + * @returns IRandomisedBotLevelResult object + */ + protected generateRandomLevel(role: string, min: number, max: number): BotGenerator.IRandomisedBotLevelResult; /** * Converts health object to the required format * @param healthObj health object from bot json @@ -72,19 +92,23 @@ export declare class BotGenerator { */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; protected generateSkills(skillsObj: Skills): Skills; - /** - * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) - * @param pmcSide eft side (usec/bear) - * @returns pmc side as defined in config - */ - protected getPmcRole(pmcSide: string): string; /** * Iterate through bots inventory and loot to find and remove christmas items (as defined in GameEventHelper) * @param nodeInventory Bots inventory to iterate over */ protected removeChristmasItemsFromBotInventory(nodeInventory: Inventory): void; + /** + * Generate a random Id for a bot and apply to bots _id and aid value + * @param bot bot to update + * @returns updated IBotBase object + */ protected generateId(bot: IBotBase): IBotBase; protected generateInventoryID(profile: IBotBase): IBotBase; + /** + * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * @param requestedDifficulty + * @returns + */ protected getPMCDifficulty(requestedDifficulty: string): string; /** * Add a side-specific (usec/bear) dogtag item to a bots inventory diff --git a/Live/CWX_DeSharpener/server/dist/types/generators/BotInventoryGenerator.d.ts b/Live/CWX_DeSharpener/server/dist/types/generators/BotInventoryGenerator.d.ts index 35d1ee8..c5ed545 100644 --- a/Live/CWX_DeSharpener/server/dist/types/generators/BotInventoryGenerator.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/generators/BotInventoryGenerator.d.ts @@ -1,13 +1,16 @@ +import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Inventory, Chances, Generation, Mods } from "../models/eft/common/tables/IBotType"; +import { Chances, Generation, Inventory, Mods } from "../models/eft/common/tables/IBotType"; +import { EquipmentSlots } from "../models/enums/EquipmentSlots"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; -import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; -import { BotWeaponGenerator } from "./BotWeaponGenerator"; import { BotLootGenerator } from "./BotLootGenerator"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; +import { BotWeaponGenerator } from "./BotWeaponGenerator"; export declare class BotInventoryGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -17,8 +20,14 @@ export declare class BotInventoryGenerator { protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper); - generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { + slot: EquipmentSlots; + shouldSpawn: boolean; + }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; protected generateInventoryBase(): PmcInventory; } diff --git a/Live/CWX_DeSharpener/server/dist/types/generators/BotLootGenerator.d.ts b/Live/CWX_DeSharpener/server/dist/types/generators/BotLootGenerator.d.ts index c6a3f29..c1f5310 100644 --- a/Live/CWX_DeSharpener/server/dist/types/generators/BotLootGenerator.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/generators/BotLootGenerator.d.ts @@ -1,4 +1,5 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; @@ -20,11 +21,12 @@ export declare class BotLootGenerator { protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botLootCacheService: BotLootCacheService, configServer: ConfigServer); - generateLoot(templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer); + generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached @@ -47,7 +49,7 @@ export declare class BotLootGenerator { * @param botRole bots role, .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; /** * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from diff --git a/Live/CWX_DeSharpener/server/dist/types/generators/BotWeaponGenerator.d.ts b/Live/CWX_DeSharpener/server/dist/types/generators/BotWeaponGenerator.d.ts index 9215214..487901b 100644 --- a/Live/CWX_DeSharpener/server/dist/types/generators/BotWeaponGenerator.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/generators/BotWeaponGenerator.d.ts @@ -1,4 +1,5 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { MinMax } from "../models/common/MinMax"; @@ -14,6 +15,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { IInventoryMagGen } from "./weapongen/IInventoryMagGen"; export declare class BotWeaponGenerator { protected jsonUtil: JsonUtil; protected logger: ILogger; @@ -24,11 +26,24 @@ export declare class BotWeaponGenerator { protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; protected configServer: ConfigServer; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, inventoryMagGenComponents: IInventoryMagGen[]); /** - * Get a random weapon from a bots pool of weapons (weighted) + * Pick a random weapon based on weightings and generate a functional weapon + * @param equipmentSlot Primary/secondary/holster + * @param botTemplateInventory e.g. assault.json + * @param weaponParentId + * @param modChances + * @param botRole role of bot, e.g. assault/followerBully + * @param isPmc Is weapon generated for a pmc + * @returns GenerateWeaponResult object + */ + generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + /** + * Get a random weighted weapon from a bots pool of weapons * @param equipmentSlot Primary/secondary/holster * @param botTemplateInventory e.g. assault.json * @returns weapon tpl @@ -39,43 +54,24 @@ export declare class BotWeaponGenerator { * @param weaponTpl weapon tpl to generate (use pickWeightedWeaponTplFromPool()) * @param equipmentSlot slot to fit into, primary/secondary/holster * @param botTemplateInventory e.g. assault.json - * @param weaponParentId - * @param modChances - * @param botRole + * @param weaponParentId ParentId of the weapon being generated + * @param modChances Dictionary of item types and % chance weapon will have that mod + * @param botRole e.g. assault/exusec * @param isPmc * @returns GenerateWeaponResult object */ - generateWeaponByTpl(weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; /** - * Generate an entirely random weapon - * @param equipmentSlot Primary/secondary/holster - * @param botTemplateInventory e.g. assault.json - * @param weaponParentId - * @param modChances - * @param botRole - * @param isPmc - * @returns GenerateWeaponResult object - */ - generateRandomWeapon(equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; - /** - * Create array with weapon base as only element - * Add additional properties as required - * @param weaponTpl - * @param weaponParentId - * @param equipmentSlot - * @param weaponItemTemplate + * Create array with weapon base as only element and + * add additional properties based on weapon type + * @param weaponTpl Weapon tpl to create item with + * @param weaponParentId Weapons parent id + * @param equipmentSlot e.g. primary/secondary/holster + * @param weaponItemTemplate db template for weapon * @param botRole for durability values - * @returns + * @returns Base weapon item in array */ - constructWeaponBaseArray(weaponTpl: string, weaponParentId: string, equipmentSlot: string, weaponItemTemplate: ITemplateItem, botRole: string): Item[]; - /** - * Add compatible magazines to an inventory based on a generated weapon - * @param weaponDetails - * @param magCounts - * @param inventory - * @param botRole the bot type we're getting generating extra mags for - */ - addExtraMagazinesToInventory(weaponDetails: GenerateWeaponResult, magCounts: MinMax, inventory: PmcInventory, botRole: string): void; + protected constructWeaponBaseArray(weaponTpl: string, weaponParentId: string, equipmentSlot: string, weaponItemTemplate: ITemplateItem, botRole: string): Item[]; /** * Get the mods necessary to kit out a weapon to its preset level * @param weaponTpl weapon to find preset for @@ -84,33 +80,21 @@ export declare class BotWeaponGenerator { * @returns array of weapon mods */ protected getPresetWeaponMods(weaponTpl: string, equipmentSlot: string, weaponParentId: string, itemTemplate: ITemplateItem, botRole: string): Item[]; - /** Checks if all required slots are occupied on a weapon and all it's mods */ + /** + * Checks if all required slots are occupied on a weapon and all it's mods + * @param weaponItemArray Weapon + mods + * @returns true if valid + */ protected isWeaponValid(weaponItemArray: Item[]): boolean; /** * Generates extra magazines or bullets (if magazine is internal) and adds them to TacticalVest and Pockets. * Additionally, adds extra bullets to SecuredContainer - * @param weaponMods - * @param weaponTemplate - * @param magCounts - * @param ammoTpl - * @param inventory - * @param botRole the bot type we're getting generating extra mags for - * @returns + * @param generatedWeaponResult object with properties for generated weapon (weapon mods pool / weapon template / ammo tpl) + * @param magCounts Magazine count to add to inventory + * @param inventory Inventory to add magazines to + * @param botRole The bot type we're getting generating extra mags for */ - protected generateExtraMagazines(weaponMods: Item[], weaponTemplate: ITemplateItem, magCounts: MinMax, ammoTpl: string, inventory: PmcInventory, botRole: string): void; - /** - * Get a randomised number of bullets for a specific magazine - * @param magCounts min and max count of magazines - * @param magTemplate magazine to generate bullet count for - * @returns bullet count number - */ - protected getRandomisedBulletCount(magCounts: MinMax, magTemplate: ITemplateItem): number; - /** - * Get a randomised count of magazines - * @param magCounts min and max value returned value can be between - * @returns numberical value of magazine count - */ - protected getRandomisedMagazineCount(magCounts: MinMax): number; + addExtraMagazinesToInventory(generatedWeaponResult: GenerateWeaponResult, magCounts: MinMax, inventory: PmcInventory, botRole: string): void; /** * Add ammo to the secure container * @param stackCount How many stacks of ammo to add @@ -127,21 +111,13 @@ export declare class BotWeaponGenerator { * @returns magazine tpl string */ protected getMagazineTplFromWeaponTemplate(weaponMods: Item[], weaponTemplate: ITemplateItem, botRole: string): string; - /** - * Get a weapons default magazine template id - * @param weaponTemplate weapon to get default magazine for - * @returns tpl of magazine - */ - protected getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - protected addBulletsToVestAndPockets(ammoTpl: string, bulletCount: number, inventory: PmcInventory): void; /** * Finds and return a compatible ammo tpl based on the bots ammo weightings (x.json/inventory/equipment/ammo) * @param ammo a list of ammo tpls the weapon can use * @param weaponTemplate the weapon we want to pick ammo for - * @param isPmc is the ammo being gathered for a pmc (runs pmc ammo filtering) * @returns an ammo tpl that works with the desired gun */ - protected getCompatibleAmmo(ammo: Record>, weaponTemplate: ITemplateItem, isPmc: boolean): string; + protected getWeightedCompatibleAmmo(ammo: Record>, weaponTemplate: ITemplateItem): string; /** * Get a weapons compatible cartridge caliber * @param weaponTemplate Weapon to look up caliber of diff --git a/Live/CWX_DeSharpener/server/dist/types/generators/LocationGenerator.d.ts b/Live/CWX_DeSharpener/server/dist/types/generators/LocationGenerator.d.ts index bd368b5..cc61dcf 100644 --- a/Live/CWX_DeSharpener/server/dist/types/generators/LocationGenerator.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/generators/LocationGenerator.d.ts @@ -3,10 +3,9 @@ import { GameEventHelper } from "../helpers/GameEventHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; -import { ILooseLoot, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; +import { ILooseLoot, SpawnpointsForced, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; import { Item } from "../models/eft/common/tables/IItem"; import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticLootDetails } from "../models/eft/common/tables/ILootBase"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -36,11 +35,19 @@ export declare class LocationGenerator { generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; + /** + * Create array of loose + forced loot using probability system + * @param dynamicLootDist + * @param staticAmmoDist + * @param locationName Location to generate loot for + * @returns Array of spawn points with loot in them + */ generateDynamicLoot(dynamicLootDist: ILooseLoot, staticAmmoDist: Record, locationName: string): SpawnpointTemplate[]; + /** + * Add forced spawn point loot into loot parameter array + * @param loot array to add forced loot to + * @param forcedSpawnPoints forced loot to add + */ + protected addForcedLoot(loot: SpawnpointTemplate[], forcedSpawnPoints: SpawnpointsForced[]): void; protected createItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; - protected getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; - protected getRandomValidCaliber(magTemplate: ITemplateItem): string; - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; - protected createRandomMagCartridges(magTemplate: ITemplateItem, parentId: string, staticAmmoDist: Record, caliber?: string): Item; - protected createCartidges(parentId: string, ammoTpl: string, stackCount: number): Item; } diff --git a/Live/CWX_DeSharpener/server/dist/types/generators/LootGenerator.d.ts b/Live/CWX_DeSharpener/server/dist/types/generators/LootGenerator.d.ts new file mode 100644 index 0000000..bbc1915 --- /dev/null +++ b/Live/CWX_DeSharpener/server/dist/types/generators/LootGenerator.d.ts @@ -0,0 +1,58 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Preset } from "../models/eft/common/IGlobals"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { LootItem } from "../models/spt/services/LootItem"; +import { LootRequest } from "../models/spt/services/LootRequest"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { HashUtil } from "../utils/HashUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class LootGenerator { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected databaseServer: DatabaseServer; + protected randomUtil: RandomUtil; + protected itemHelper: ItemHelper; + protected itemFilterService: ItemFilterService; + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, itemFilterService: ItemFilterService); + /** + * Generate a list of items based on options passed in + * @param options parameters to adjust what loot is generated + * @returns An array of loot items + */ + createRandomloot(options: LootRequest): LootItem[]; + /** + * Construct item limit record to hold max and current item count + * @param limits limits as defined in config + * @returns record, key: item tplId, value: current/max item count allowed + */ + protected initItemLimitCounter(limits: Record): Record; + /** + * Find a random item in items.json and add to result array + * @param items items to choose from + * @param itemTypeCounts item limit counts + * @param options item filters + * @param result array to add found item to + * @returns true if item was valid and added to pool + */ + protected findAndAddRandomItemToLoot(items: [string, ITemplateItem][], itemTypeCounts: Record, options: LootRequest, result: LootItem[]): boolean; + /** + * + * Find a random item in items.json and add to result array + * @param globalDefaultPresets presets to choose from + * @param itemTypeCounts item limit counts + * @param result array to add found preset to + * @returns true if preset was valid and added to pool + */ + protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, Preset][], itemTypeCounts: Record, result: LootItem[]): boolean; +} diff --git a/Live/CWX_DeSharpener/server/dist/types/generators/PMCLootGenerator.d.ts b/Live/CWX_DeSharpener/server/dist/types/generators/PMCLootGenerator.d.ts index 64e6f7f..b9f2a83 100644 --- a/Live/CWX_DeSharpener/server/dist/types/generators/PMCLootGenerator.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/generators/PMCLootGenerator.d.ts @@ -1,15 +1,21 @@ import { ItemHelper } from "../helpers/ItemHelper"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ConfigServer } from "../servers/ConfigServer"; import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +/** + * Handle the generation of dynamic PMC loot in pockets and backpacks + * and the removal of blacklisted items + */ export declare class PMCLootGenerator { protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; + protected itemFilterService: ItemFilterService; protected pocketLootPool: string[]; protected backpackLootPool: string[]; protected botConfig: IBotConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService); generatePMCPocketLootPool(): string[]; generatePMCBackpackLootPool(): string[]; } diff --git a/Live/CWX_DeSharpener/server/dist/types/generators/RagfairAssortGenerator.d.ts b/Live/CWX_DeSharpener/server/dist/types/generators/RagfairAssortGenerator.d.ts index cbdd7f2..db4811d 100644 --- a/Live/CWX_DeSharpener/server/dist/types/generators/RagfairAssortGenerator.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/generators/RagfairAssortGenerator.d.ts @@ -1,5 +1,8 @@ import { ItemHelper } from "../helpers/ItemHelper"; +import { Preset } from "../models/eft/common/IGlobals"; import { Item } from "../models/eft/common/tables/IItem"; +import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -8,18 +11,40 @@ export declare class RagfairAssortGenerator { protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; protected generatedAssortItems: Item[]; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer); + protected ragfairConfig: IRagfairConfig; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); /** * Get an array of unique items that can be sold on the flea * @returns array of unique items */ getAssortItems(): Item[]; + /** + * Check internal generatedAssortItems array has objects + * @returns true if array has objects + */ protected assortsAreGenerated(): boolean; /** * Generate an array of items the flea can sell * @returns array of unique items */ protected generateRagfairAssortItems(): Item[]; + /** + * Get presets from globals.json + * @returns Preset object array + */ + protected getPresets(): Preset[]; + /** + * Get default presets from globals.json + * @returns Preset object array + */ + protected getDefaultPresets(): Preset[]; + /** + * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true + * @param tplId tplid to add to item + * @param id id to add to item + * @returns hydrated Item object + */ protected createRagfairAssortItem(tplId: string, id?: string): Item; } diff --git a/Live/CWX_DeSharpener/server/dist/types/generators/RagfairOfferGenerator.d.ts b/Live/CWX_DeSharpener/server/dist/types/generators/RagfairOfferGenerator.d.ts index 3e7f4cc..317cd6b 100644 --- a/Live/CWX_DeSharpener/server/dist/types/generators/RagfairOfferGenerator.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/generators/RagfairOfferGenerator.d.ts @@ -41,15 +41,37 @@ export declare class RagfairOfferGenerator { createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; protected getTraderId(userID: string): string; protected getRating(userID: string): number; + /** + * Is the offers user rating growing + * @param userID user to check rating of + * @returns true if its growing + */ protected getRatingGrowing(userID: string): boolean; + /** + * Get number of section until offer should expire + * @param userID Id of the offer owner + * @param time Time the offer is posted + * @returns number of seconds until offer expires + */ protected getOfferEndTime(userID: string, time: number): number; /** * Create multiple offers for items by using a unique list of items we've generated previously - * @param expiredOffers + * @param expiredOffers optional, expired offers to regenerate */ generateDynamicOffers(expiredOffers?: Item[]): void; - generateTraderOffers(traderID: string): void; + /** + * Generate trader offers on flea using the traders assort data + * @param traderID Trader to generate offers for + */ + generateFleaOffersForTrader(traderID: string): void; protected getItemCondition(userID: string, items: Item[], itemDetails: ITemplateItem): Item[]; + /** + * Add missing conditions to an item if needed + * Durabiltiy for repairable items + * HpResource for medical items + * @param item item to add conditions to + * @returns Item with conditions added + */ protected addMissingCondition(item: Item): Item; protected getOfferRequirements(items: Item[]): { count: number; @@ -57,6 +79,14 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a flea offer and store it in the Ragfair server offers array + * @param userID owner of the offer + * @param time time offer is put up + * @param items items in the offer + * @param barterScheme + * @param loyalLevel + * @param price price of offer + * @param sellInOnePiece + * @returns */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/Live/CWX_DeSharpener/server/dist/types/generators/ScavCaseRewardGenerator.d.ts b/Live/CWX_DeSharpener/server/dist/types/generators/ScavCaseRewardGenerator.d.ts index c7d6ab7..89cb5c8 100644 --- a/Live/CWX_DeSharpener/server/dist/types/generators/ScavCaseRewardGenerator.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/generators/ScavCaseRewardGenerator.d.ts @@ -8,9 +8,13 @@ import { RewardCountAndPriceDetails, ScavCaseRewardCountsAndPrices } from "../mo import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { RagfairPriceService } from "../services/RagfairPriceService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +/** + * Handle the creation of randomised scav case rewards + */ export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; @@ -18,9 +22,10 @@ export declare class ScavCaseRewardGenerator { protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param body client request diff --git a/Live/CWX_DeSharpener/server/dist/types/generators/WeatherGenerator.d.ts b/Live/CWX_DeSharpener/server/dist/types/generators/WeatherGenerator.d.ts index 44cecbb..8ddbe49 100644 --- a/Live/CWX_DeSharpener/server/dist/types/generators/WeatherGenerator.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/generators/WeatherGenerator.d.ts @@ -1,7 +1,7 @@ import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { ConfigServer } from "../servers/ConfigServer"; import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class WeatherGenerator { @@ -21,11 +21,16 @@ export declare class WeatherGenerator { protected getAcceleratedTime(computedDate: Date): string; /** * Get current time formatted to fit BSGs requirement - * @param computedDate + * @param computedDate date to format into bsg style * @returns */ protected getNormalTime(computedDate: Date): string; - generateWeather(data: IWeatherData): IWeatherData; + /** + * Return randomised Weather data + * @param weatherData weather input data + * @returns Randomised weather data + */ + generateWeather(weatherData: IWeatherData): IWeatherData; protected getWeightedFog(): string; protected getWeightedRain(): number; protected getRandomFloat(node: string): number; diff --git a/Live/CWX_DeSharpener/server/dist/types/generators/weapongen/IInventoryMagGen.d.ts b/Live/CWX_DeSharpener/server/dist/types/generators/weapongen/IInventoryMagGen.d.ts new file mode 100644 index 0000000..792f510 --- /dev/null +++ b/Live/CWX_DeSharpener/server/dist/types/generators/weapongen/IInventoryMagGen.d.ts @@ -0,0 +1,6 @@ +import { InventoryMagGen } from "./InventoryMagGen"; +export interface IInventoryMagGen { + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_DeSharpener/server/dist/types/generators/weapongen/InventoryMagGen.d.ts b/Live/CWX_DeSharpener/server/dist/types/generators/weapongen/InventoryMagGen.d.ts new file mode 100644 index 0000000..30bf79f --- /dev/null +++ b/Live/CWX_DeSharpener/server/dist/types/generators/weapongen/InventoryMagGen.d.ts @@ -0,0 +1,16 @@ +import { MinMax } from "../../models/common/MinMax"; +import { Inventory } from "../../models/eft/common/tables/IBotBase"; +import { ITemplateItem } from "../../models/eft/common/tables/ITemplateItem"; +export declare class InventoryMagGen { + private magCounts; + private magazineTemplate; + private weaponTemplate; + private ammoTemplate; + private pmcInventory; + constructor(magCounts: MinMax, magazineTemplate: ITemplateItem, weaponTemplate: ITemplateItem, ammoTemplate: ITemplateItem, pmcInventory: Inventory); + getMagCount(): MinMax; + getMagazineTemplate(): ITemplateItem; + getWeaponTemplate(): ITemplateItem; + getAmmoTemplate(): ITemplateItem; + getPmcInventory(): Inventory; +} diff --git a/Live/CWX_DeSharpener/server/dist/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts b/Live/CWX_DeSharpener/server/dist/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts new file mode 100644 index 0000000..b754d5f --- /dev/null +++ b/Live/CWX_DeSharpener/server/dist/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts @@ -0,0 +1,12 @@ +import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; +import { RandomUtil } from "../../../utils/RandomUtil"; +import { IInventoryMagGen } from "../IInventoryMagGen"; +import { InventoryMagGen } from "../InventoryMagGen"; +export declare class BarrelInventoryMagGen implements IInventoryMagGen { + protected randomUtil: RandomUtil; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + constructor(randomUtil: RandomUtil, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_DeSharpener/server/dist/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/Live/CWX_DeSharpener/server/dist/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts new file mode 100644 index 0000000..4fcb1e2 --- /dev/null +++ b/Live/CWX_DeSharpener/server/dist/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -0,0 +1,14 @@ +import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; +import { ItemHelper } from "../../../helpers/ItemHelper"; +import { ILogger } from "../../../models/spt/utils/ILogger"; +import { IInventoryMagGen } from "../IInventoryMagGen"; +import { InventoryMagGen } from "../InventoryMagGen"; +export declare class ExternalInventoryMagGen implements IInventoryMagGen { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + constructor(logger: ILogger, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_DeSharpener/server/dist/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts b/Live/CWX_DeSharpener/server/dist/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts new file mode 100644 index 0000000..4548a04 --- /dev/null +++ b/Live/CWX_DeSharpener/server/dist/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts @@ -0,0 +1,10 @@ +import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; +import { IInventoryMagGen } from "../IInventoryMagGen"; +import { InventoryMagGen } from "../InventoryMagGen"; +export declare class InternalMagazineInventoryMagGen implements IInventoryMagGen { + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + constructor(botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_DeSharpener/server/dist/types/helpers/AssortHelper.d.ts b/Live/CWX_DeSharpener/server/dist/types/helpers/AssortHelper.d.ts index 15586b9..bfc157f 100644 --- a/Live/CWX_DeSharpener/server/dist/types/helpers/AssortHelper.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/helpers/AssortHelper.d.ts @@ -17,7 +17,7 @@ export declare class AssortHelper { * @param assort assort items from a trader * @returns assort items minus locked quest assorts */ - stripLockedQuestAssort(pmcProfile: IPmcData, traderId: string, assort: ITraderAssort): ITraderAssort; + stripLockedQuestAssort(pmcProfile: IPmcData, traderId: string, assort: ITraderAssort, flea?: boolean): ITraderAssort; /** * Remove assorts from a trader that have not been unlocked yet * @param pmcProfile player profile @@ -32,5 +32,5 @@ export declare class AssortHelper { * @param itemID item id to remove from asort * @returns Modified assort */ - removeItemFromAssort(assort: ITraderAssort, itemID: string): ITraderAssort; + removeItemFromAssort(assort: ITraderAssort, itemID: string, flea?: boolean): ITraderAssort; } diff --git a/Live/CWX_DeSharpener/server/dist/types/helpers/BotGeneratorHelper.d.ts b/Live/CWX_DeSharpener/server/dist/types/helpers/BotGeneratorHelper.d.ts index 3cd7256..5e3e501 100644 --- a/Live/CWX_DeSharpener/server/dist/types/helpers/BotGeneratorHelper.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/helpers/BotGeneratorHelper.d.ts @@ -1,19 +1,33 @@ import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper"; -import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem"; -import { Grid, ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { ItemFilterService } from "../services/ItemFilterService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotWeaponGeneratorHelper } from "./BotWeaponGeneratorHelper"; import { ContainerHelper } from "./ContainerHelper"; import { InventoryHelper } from "./InventoryHelper"; import { ItemHelper } from "./ItemHelper"; import { ProbabilityHelper } from "./ProbabilityHelper"; +import { ProfileHelper } from "./ProfileHelper"; +export declare class BotModLimits { + scope: ItemCount; + scopeMax: number; + scopeBaseTypes: string[]; + flashlightLaser: ItemCount; + flashlightLaserMax: number; + flashlgihtLaserBaseTypes: string[]; +} +export declare class ItemCount { + count: number; +} export declare class BotGeneratorHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -25,16 +39,121 @@ export declare class BotGeneratorHelper { protected itemHelper: ItemHelper; protected inventoryHelper: InventoryHelper; protected containerHelper: ContainerHelper; + protected botEquipmentFilterService: BotEquipmentFilterService; + protected itemFilterService: ItemFilterService; + protected profileHelper: ProfileHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, configServer: ConfigServer); - generateModsForItem(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, configServer: ConfigServer); /** - * Is this magazine cylinder related (revolvers and grenade launchers) - * @param magazineParentName the name of the magazines parent - * @returns true if it is cylinder related + * Check mods are compatible and add to array + * @param equipment Equipment item to add mods to + * @param modPool Mod list to choose frm + * @param parentId parentid of item to add mod to + * @param parentTemplate template objet of item to add mods to + * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @returns Item + compatible mods as an array */ - magazineIsCylinderRelated(magazineParentName: string): boolean; + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + /** + * @param sessionId session id + * @param weapon Weapon to add mods to + * @param modPool Pool of compatible mods to attach to weapon + * @param weaponParentId parentId of weapon + * @param parentWeaponTemplate Weapon which mods will be generated on + * @param modSpawnChances Mod spawn chances + * @param ammoTpl Ammo tpl to use when generating magazines/cartridges + * @param botRole Role of bot weapon is generated for + * @returns Weapon + mods array + */ + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; + /** + * + * @param modSlot + * @param isRandomisableSlot + * @param modsParent + * @param botEquipBlacklist + * @param itemModPool + * @param weapon array with only weapon tpl in it, ready for mods to be added + * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) + * @param parentTemplate + * @returns + */ + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + /** + * Find mod tpls of a provided type and add to modPool + * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) + * @param modTemplate db object for modItem we get compatible mods from + * @param modPool Pool of mods we are adding to + */ + protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; + /** + * Check if mod item is on limited list + has surpassed the limit set for it + * @param botRole role the bot has e.g. assault + * @param modTemplate mods template data + * @param modLimits limits set for weapon being generated for this bot + * @returns true if over item limit + */ + protected modHasReachedItemLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits): boolean; + /** + * Initalise mod limits to be used when generating a weapon + * @param botRole "assault", "bossTagilla" or "pmc" + * @returns BotModLimits object + */ + protected initModLimits(botRole: string): BotModLimits; + /** + * Generate a pool of mods for this bots mod type if bot has values inside `randomisedWeaponModSlots` array found in bot.json/equipment[botrole] + * @param allowedMods Mods to be added to mod pool + * @param botEquipBlacklist blacklist of items not allowed to be added to mod pool + * @param modSlot Slot to generate mods for + * @param itemModPool base mod pool to replace values of + */ + protected generateDynamicWeaponModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record): void; + /** + * Find all compatible mods for equipment item and add to modPool + * @param itemDetails item to find mods for + * @param modPool ModPool to add mods to + */ + generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods): void; + /** + * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist + * @param allowedMods base mods to filter + * @param botEquipBlacklist equipment blacklist + * @param modSlot slot mods belong to + * @returns Filtered array of mod tpls + */ + protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; + /** + * Check if the specific item type on the weapon has reached the set limit + * @param modTpl log mod tpl if over type limit + * @param currentCount current number of this item on gun + * @param maxLimit mod limit allowed + * @param botRole role of bot we're checking weapon of + * @returns true if limit reached + */ + protected weaponModLimitReached(modTpl: string, currentCount: { + count: number; + }, maxLimit: number, botRole: string): boolean; + /** + * Log errors if mod is not compatible with slot + * @param modToAdd template of mod to check + * @param itemSlot slot the item will be placed in + * @param modSlot slot the mod will fill + * @param parentTemplate tempalte of the mods parent item + * @returns true if valid + */ + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + /** + * Create a mod item with parameters as properties + * @param modId _id + * @param modTpl _tpl + * @param parentId parentId + * @param modSlot slotId + * @param modTemplate Used to add additional properites in the upd object + * @returns Item object + */ + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem): Item; /** * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance @@ -46,7 +165,7 @@ export declare class BotGeneratorHelper { protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; /** * Get a list of containers that hold ammo - * e.g. mod_magazine + * e.g. mod_magazine / patron_in_weapon_000 * @returns string array */ protected getAmmoContainers(): string[]; @@ -62,11 +181,11 @@ export declare class BotGeneratorHelper { * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" - * - * @param {object} items The items where the CylinderMagazine's camora are appended to - * @param {object} modPool modPool which should include available cartrigdes - * @param {string} parentId The CylinderMagazine's UID - * @param {object} parentTemplate The CylinderMagazine's template + * @param items The items where the CylinderMagazine's camora are appended to + * @param modPool modPool which should include available cartrigdes + * @param parentId The CylinderMagazine's UID + * @param parentTemplate The CylinderMagazine's template + * @returns */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** @@ -75,6 +194,13 @@ export declare class BotGeneratorHelper { * @returns string array of shells fro luitple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + /** + * Adds properties to an item + * e.g. Repairable / HasHinge / Foldable / MaxDurability + * @param itemTemplate + * @param botRole Used by weapons to randomise the durability values + * @returns Item Upd object with extra properties + */ generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { upd?: Upd; }; @@ -92,13 +218,15 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; - protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** - * Sort by spawn chance, highest to lowest, higher is more common - * @param unsortedModArray String array to sort - * @returns Sorted string array + * Get a random mod from an items compatible mods Filter array + * @param modTpl + * @param parentSlot + * @param modSlot + * @param items + * @returns item tpl */ - protected sortModArray(unsortedModArray: string[]): string[]; + protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** * Can an item be added to an item without issue * @param items @@ -107,18 +235,8 @@ export declare class BotGeneratorHelper { * @returns true if possible */ isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; - /** - * Adds an item with all its childern into specified equipmentSlots, wherever it fits. - * @param equipmentSlots - * @param parentId - * @param parentTpl - * @param itemWithChildren - * @param inventory - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: PmcInventory): boolean; - protected itemAllowedInContainer(slot: Grid, itemTpl: string): boolean; } +/** TODO - move into own class */ export declare class ExhaustableArray { private itemPool; private randomUtil; diff --git a/Live/CWX_DeSharpener/server/dist/types/helpers/BotHelper.d.ts b/Live/CWX_DeSharpener/server/dist/types/helpers/BotHelper.d.ts index 9b89481..18738e5 100644 --- a/Live/CWX_DeSharpener/server/dist/types/helpers/BotHelper.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/helpers/BotHelper.d.ts @@ -13,11 +13,34 @@ export declare class BotHelper { protected configServer: ConfigServer; protected botConfig: IBotConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, configServer: ConfigServer); + /** + * Get difficulty settings for desired bot type, if not found use assault bot types + * @param type bot type to retreive difficulty of + * @param difficulty difficulty to get settings for (easy/normal etc) + * @returns Difficulty object + */ getBotDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Get a template object for the specified botRole from bots.types db + * @param role botRole to get template for + * @returns IBotType object + */ getBotTemplate(role: string): IBotType; + /** + * Get difficulty settings for a PMC + * @param type "usec" / "bear" + * @param difficulty what difficulty to retrieve + * @returns Difficulty object + */ getPmcDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Choose a random difficulty from - easy/normal/hard/impossible + * @returns random difficulty + */ + chooseRandomDifficulty(): string; /** * Randomise the chance the PMC will attack their own side + * Look up value in bot.json/chanceSameSideIsHostilePercent * @param difficultySettings pmc difficulty settings */ randomisePmcHostility(difficultySettings: Difficulty): void; @@ -31,7 +54,7 @@ export declare class BotHelper { */ addBotToFriendlyList(difficultySettings: Difficulty, typeToAdd: string): void; /** - * Add a bot to the ENEMY_BOT_TYPES array + * Add a bot to the ENEMY_BOT_TYPES array, do not add itself if its on the enemy list * @param difficultySettings bot settings to alter * @param typesToAdd bot type to add to enemy list */ @@ -42,4 +65,10 @@ export declare class BotHelper { * @param typesToAdd bot type to add to revenge list */ addBotToRevengeList(difficultySettings: Difficulty, typesToAdd: string[]): void; + /** + * Choose if a bot should become a PMC by checking if bot type is allowed to become a Pmc in botConfig.convertFromChances and doing a random int check + * @param botRole the bot role to check if should be a pmc + * @returns true if should be a pmc + */ + shouldBotBePmc(botRole: string): boolean; } diff --git a/Live/CWX_DeSharpener/server/dist/types/helpers/BotWeaponGeneratorHelper.d.ts b/Live/CWX_DeSharpener/server/dist/types/helpers/BotWeaponGeneratorHelper.d.ts new file mode 100644 index 0000000..7e25f56 --- /dev/null +++ b/Live/CWX_DeSharpener/server/dist/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -0,0 +1,78 @@ +import { MinMax } from "../models/common/MinMax"; +import { Inventory } from "../models/eft/common/tables/IBotBase"; +import { Item } from "../models/eft/common/tables/IItem"; +import { Grid, ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { HashUtil } from "../utils/HashUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { ContainerHelper } from "./ContainerHelper"; +import { InventoryHelper } from "./InventoryHelper"; +import { ItemHelper } from "./ItemHelper"; +export declare class BotWeaponGeneratorHelper { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper); + /** + * Get a randomised number of bullets for a specific magazine + * @param magCounts min and max count of magazines + * @param magTemplate magazine to generate bullet count for + * @returns bullet count number + */ + getRandomisedBulletCount(magCounts: MinMax, magTemplate: ITemplateItem): number; + /** + * Get a randomised count of magazines + * @param magCounts min and max value returned value can be between + * @returns numberical value of magazine count + */ + getRandomisedMagazineCount(magCounts: MinMax): number; + /** + * Is this magazine cylinder related (revolvers and grenade launchers) + * @param magazineParentName the name of the magazines parent + * @returns true if it is cylinder related + */ + magazineIsCylinderRelated(magazineParentName: string): boolean; + /** + * Create a magazine using the parameters given + * @param magazineTpl Tpl of the magazine to create + * @param ammoTpl Ammo to add to magazine + * @param magTemplate template object of magazine + * @returns Item array + */ + createMagazine(magazineTpl: string, ammoTpl: string, magTemplate: ITemplateItem): Item[]; + /** + * Add a specific number of cartrdiges to a bots inventory (vest/pocket) + * @param ammoTpl Ammo tpl to add to vest/pockets + * @param cartridgeCount number of cartridges to add to vest/pockets + * @param inventory bot inventory to add cartridges to + */ + addBulletsToVestAndPockets(ammoTpl: string, cartridgeCount: number, inventory: Inventory): void; + /** + * Get a weapons default magazine template id + * @param weaponTemplate weapon to get default magazine for + * @returns tpl of magazine + */ + getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; + /** + * Adds an item with all its childern into specified equipmentSlots, wherever it fits. + * @param equipmentSlots + * @param parentId + * @param parentTpl + * @param itemWithChildren + * @param inventory + * @returns a `boolean` indicating item was added + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): boolean; + /** + * is the provided item allowed inside a container + * @param slot location item wants to be placed in + * @param itemTpl item being placed + * @returns true if allowed + */ + protected itemAllowedInContainer(slot: Grid, itemTpl: string): boolean; +} diff --git a/Live/CWX_DeSharpener/server/dist/types/helpers/HideoutHelper.d.ts b/Live/CWX_DeSharpener/server/dist/types/helpers/HideoutHelper.d.ts index 36e4009..7495a6a 100644 --- a/Live/CWX_DeSharpener/server/dist/types/helpers/HideoutHelper.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/helpers/HideoutHelper.d.ts @@ -44,14 +44,72 @@ export declare class HideoutHelper { initProduction(recipeId: string, productionTime: number): Production; isProductionType(productive: Productive): productive is Production; applyPlayerUpgradesBonuses(pmcData: IPmcData, bonus: StageBonus): void; + /** + * TODO: + * After looking at the skills there doesnt seem to be a configuration per skill to boost + * the XP gain PER skill. I THINK you should be able to put the variable "SkillProgress" (just like health has it) + * and be able to tune the skill gain PER skill, but I havent tested it and Im not sure! + * @param pmcData + * @param bonus + */ protected applySkillXPBoost(pmcData: IPmcData, bonus: StageBonus): void; + /** + * Process a players hideout, update areas that use resources + increment production timers + * @param sessionID Session id + */ updatePlayerHideout(sessionID: string): void; + /** + * Update progress timer for water collector + * @param pmcData profile to update + * @param productionId id of water collection production to update + * @param hideoutProperties Hideout properties + */ + protected updateWaterCollectorProductionTimer(pmcData: IPmcData, productionId: string, hideoutProperties: { + btcFarmCGs?: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Update progress timer for scav case + * @param pmcData Profile to update + * @param productionId Id of scav case production to update + */ + protected updateScavCaseProductionTimer(pmcData: IPmcData, productionId: string): void; + /** + * Iterate over hideout areas that use resources (fuel/filters etc) and update associated values + * @param sessionID Session id + * @param pmcData Profile to update areas of + * @param hideoutProperties hideout properties + */ + protected updateAreasWithResources(sessionID: string, pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): HideoutArea; - protected updateWaterFilters(waterFilterArea: HideoutArea, pwProd: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; + /** + * Adjust water filter objects resourceValue or delete when they reach 0 resource + * @param waterFilterArea water filter area to update + * @param production production object + * @param isGeneratorOn is generatory enabled + * @param pmcData Player profile + * @returns Updated HideoutArea object + */ + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): HideoutArea; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; protected getBTCSlots(pmcData: IPmcData): number; protected getManagementSkillsSlots(): number; diff --git a/Live/CWX_DeSharpener/server/dist/types/helpers/InRaidHelper.d.ts b/Live/CWX_DeSharpener/server/dist/types/helpers/InRaidHelper.d.ts index c3cbfbb..962df38 100644 --- a/Live/CWX_DeSharpener/server/dist/types/helpers/InRaidHelper.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -15,19 +16,8 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); - /** - * Reset the SPT inraid property stored in a profile to 'none' - * @param sessionID Session id - */ - protected removePlayer(sessionID: string): void; - /** - * Some maps have one-time-use keys (e.g. Labs - * Remove the relevant key from an inventory based on the post-raid request data passed in - * @param offraidData post-raid data - * @param sessionID Session id - */ - protected removeMapAccessKey(offraidData: ISaveProgressRequestData, sessionID: string): void; + protected profileFixerService: ProfileFixerService; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); /** * Check an array of items and add an upd object to money items with a stack count of 1 * Single stack money items have no upd object and thus no StackObjectsCount, causing issues @@ -52,6 +42,18 @@ export declare class InRaidHelper { * @returns Reset profile object */ updateProfileBaseStats(profileData: IPmcData, saveProgressRequest: ISaveProgressRequestData, sessionID: string): IPmcData; + /** + * Some maps have one-time-use keys (e.g. Labs + * Remove the relevant key from an inventory based on the post-raid request data passed in + * @param offraidData post-raid data + * @param sessionID Session id + */ + protected removeMapAccessKey(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Set the SPT inraid location Profile property to 'none' + * @param sessionID Session id + */ + protected setPlayerInRaidLocationStatusToNone(sessionID: string): void; /** * Adds SpawnedInSession property to items found in a raid * Removes SpawnedInSession for non-scav players if item was taken into raid with SpawnedInSession = true @@ -93,5 +95,10 @@ export declare class InRaidHelper { * @returns true if item is kept after death */ isItemKeptAfterDeath(slotId: string): boolean; + /** + * Return the equipped items from a players inventory + * @param items Players inventory to search through + * @returns an array of equipped items + */ getPlayerGear(items: Item[]): Item[]; } diff --git a/Live/CWX_DeSharpener/server/dist/types/helpers/InventoryHelper.d.ts b/Live/CWX_DeSharpener/server/dist/types/helpers/InventoryHelper.d.ts index dc7cbca..b8e5c9d 100644 --- a/Live/CWX_DeSharpener/server/dist/types/helpers/InventoryHelper.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/helpers/InventoryHelper.d.ts @@ -43,6 +43,7 @@ export declare class InventoryHelper { constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; diff --git a/Live/CWX_DeSharpener/server/dist/types/helpers/ItemHelper.d.ts b/Live/CWX_DeSharpener/server/dist/types/helpers/ItemHelper.d.ts index 1701c62..0effaf2 100644 --- a/Live/CWX_DeSharpener/server/dist/types/helpers/ItemHelper.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/helpers/ItemHelper.d.ts @@ -1,35 +1,30 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { InsuredItem } from "../models/eft/common/tables/IBotBase"; import { Item, Repairable } from "../models/eft/common/tables/IItem"; +import { IStaticAmmoDetails } from "../models/eft/common/tables/ILootBase"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ObjectId } from "../utils/ObjectId"; +import { RandomUtil } from "../utils/RandomUtil"; declare class ItemHelper { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected randomUtil: RandomUtil; + protected objectId: ObjectId; + protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer); /** - * Checks if a id is a valid item. Valid meaning that it's an item that be stored in stash + * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl * @returns boolean; true for items that may be in player posession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {*} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - isValidRewardItem(tpl: string): boolean; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - getRewardableItems(): [string, ITemplateItem][]; /** * Check if the tpl / template Id provided is a descendent of the baseclass * @@ -84,6 +79,11 @@ declare class ItemHelper { * @returns {array} The array of StackSlotItems */ generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; + /** + * Get cloned copy of all item data from items.json + * @returns array of ITemplateItem objects + */ + getItems(): ITemplateItem[]; /** * Gets item data from items.json * @param tpl items template id to look up @@ -196,6 +196,22 @@ declare class ItemHelper { * @returns ItemSize object (width and height) */ getItemSize(items: Item[], rootItemId: string): ItemHelper.ItemSize; + /** + * Get a random cartridge from an items Filter property + * @param item + * @returns + */ + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + createRandomMagCartridges(magTemplate: ITemplateItem, parentId: string, staticAmmoDist: Record, caliber?: string): Item; + protected getRandomValidCaliber(magTemplate: ITemplateItem): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + createCartidges(parentId: string, ammoTpl: string, stackCount: number): Item; + /** + * Get the size of a stack, return 1 if no stack object count property found + * @param item Item to get stack size of + * @returns size of stack + */ + getItemStackSize(item: Item): number; } declare namespace ItemHelper { interface ItemSize { diff --git a/Live/CWX_DeSharpener/server/dist/types/helpers/ProfileHelper.d.ts b/Live/CWX_DeSharpener/server/dist/types/helpers/ProfileHelper.d.ts index 6c150c8..9c6560a 100644 --- a/Live/CWX_DeSharpener/server/dist/types/helpers/ProfileHelper.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/helpers/ProfileHelper.d.ts @@ -2,24 +2,41 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Stats } from "../models/eft/common/tables/IBotBase"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; +import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { ItemHelper } from "./ItemHelper"; export declare class ProfileHelper { + protected logger: ILogger; protected jsonUtil: JsonUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected profileSnapshotService: ProfileSnapshotService; protected fenceService: FenceService; - constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; getCompleteProfile(sessionID: string): IPmcData[]; + /** + * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen + * Server saves the post-raid changes prior to the xp screen getting the profile, this results in the xp screen using + * the now updated profile values as a base, meaning it shows x2 xp gained + * Instead, clone the post-raid profile (so we dont alter its values), apply the pre-raid xp values to the cloned objects and return + * Delete snapshot of pre-raid profile prior to returning profile data + * @param sessionId Session id + * @param output pmc and scav profiles array + * @param pmcProfile post-raid pmc profile + * @param scavProfile post-raid scav profile + * @returns updated profile array + */ + protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; /** * Add experience to a PMC inside the players profile diff --git a/Live/CWX_DeSharpener/server/dist/types/helpers/QuestHelper.d.ts b/Live/CWX_DeSharpener/server/dist/types/helpers/QuestHelper.d.ts index 0f68cd5..d66d150 100644 --- a/Live/CWX_DeSharpener/server/dist/types/helpers/QuestHelper.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/helpers/QuestHelper.d.ts @@ -36,13 +36,30 @@ export declare class QuestHelper { protected configServer: ConfigServer; protected questConfig: IQuestConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); - questStatus(pmcData: IPmcData, questID: string): QuestStatus; /** - * returns true is the condition is satisfied + * Get status of a quest by quest id + * @param pmcData Profile to search + * @param questID Quest id to look up + * @returns QuestStauts enum + */ + getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus; + /** + * returns true is the level condition is satisfied + * @param playerLevel Players level + * @param condition Quest condition + * @returns true if player level is greater than or equal to quest */ - evaluateLevel(pmcProfile: IPmcData, cond: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; - rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progress: number): void; + /** + * Increase skill points of a skill on player profile + * @param sessionID Session id + * @param pmcData Player profile + * @param output output object to send back to client + * @param skillName Name of skill to increase skill points of + * @param progressAmount Amount of skill points to add to skill + */ + rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; getQuestLocale(questId: string): any; /** * Debug Routine for showing some information on the diff --git a/Live/CWX_DeSharpener/server/dist/types/helpers/RagfairOfferHelper.d.ts b/Live/CWX_DeSharpener/server/dist/types/helpers/RagfairOfferHelper.d.ts index 8d03bee..e9d72ca 100644 --- a/Live/CWX_DeSharpener/server/dist/types/helpers/RagfairOfferHelper.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/helpers/RagfairOfferHelper.d.ts @@ -22,12 +22,14 @@ import { ProfileHelper } from "./ProfileHelper"; import { RagfairHelper } from "./RagfairHelper"; import { RagfairServerHelper } from "./RagfairServerHelper"; import { RagfairSortHelper } from "./RagfairSortHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class RagfairOfferHelper { protected logger: ILogger; protected timeUtil: TimeUtil; protected hashUtil: HashUtil; protected itemEventRouter: ItemEventRouter; protected databaseServer: DatabaseServer; + protected traderHelper: TraderHelper; protected saveServer: SaveServer; protected dialogueHelper: DialogueHelper; protected itemHelper: ItemHelper; @@ -43,10 +45,10 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; - processOffers(sessionID: string): boolean; + processOffersOnProfile(sessionID: string): boolean; protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; diff --git a/Live/CWX_DeSharpener/server/dist/types/helpers/RagfairSellHelper.d.ts b/Live/CWX_DeSharpener/server/dist/types/helpers/RagfairSellHelper.d.ts index 6ec004a..91b8a20 100644 --- a/Live/CWX_DeSharpener/server/dist/types/helpers/RagfairSellHelper.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/helpers/RagfairSellHelper.d.ts @@ -11,6 +11,12 @@ export declare class RagfairSellHelper { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateSellChance(baseChance: number, offerPrice: number, requirementsPriceInRub: number): number; - rollForSale(sellChance: number, count: number): SellResult[]; + calculateSellChance(baseChancePercent: number, offerPriceRub: number, playerListedPriceRub: number): number; + /** + * Determine if the offer being listed will be sold + * @param sellChancePercent chance item will sell + * @param itemSellCount count of items to sell + * @returns Array of purchases of item(s) lsited + */ + rollForSale(sellChancePercent: number, itemSellCount: number): SellResult[]; } diff --git a/Live/CWX_DeSharpener/server/dist/types/helpers/RagfairServerHelper.d.ts b/Live/CWX_DeSharpener/server/dist/types/helpers/RagfairServerHelper.d.ts index e4939d1..a03cdda 100644 --- a/Live/CWX_DeSharpener/server/dist/types/helpers/RagfairServerHelper.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/helpers/RagfairServerHelper.d.ts @@ -6,6 +6,7 @@ import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -13,6 +14,9 @@ import { RandomUtil } from "../utils/RandomUtil"; import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { ProfileHelper } from "./ProfileHelper"; +/** + * Helper class for common ragfair server actions + */ export declare class RagfairServerHelper { protected randomUtil: RandomUtil; protected hashUtil: HashUtil; @@ -23,11 +27,12 @@ export declare class RagfairServerHelper { protected localeService: LocaleService; protected dialogueHelper: DialogueHelper; protected jsonUtil: JsonUtil; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; protected static goodsReturnedTemplate: string; - constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); + constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Is item valid / on blacklist / quest item * @param itemDetails diff --git a/Live/CWX_DeSharpener/server/dist/types/helpers/RepairHelper.d.ts b/Live/CWX_DeSharpener/server/dist/types/helpers/RepairHelper.d.ts index 9a3ab29..5b09320 100644 --- a/Live/CWX_DeSharpener/server/dist/types/helpers/RepairHelper.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/helpers/RepairHelper.d.ts @@ -14,8 +14,17 @@ export declare class RepairHelper { protected configServer: ConfigServer; protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); - updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit?: boolean, applyRandomDegradation?: boolean): Item; - protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number): number; - protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, armorMax: number): number; + /** + * + * @param itemToRepair item to update durability details + * @param itemToRepairDetails db details of item to repair + * @param isArmor Is item being repaired a piece of armor + * @param amountToRepair how many unit of durability to repair + * @param useRepairKit Is item being repaired with a repair kit + * @param applyMaxDurabilityDegradation should item have max durability reduced + */ + updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit: boolean, traderQualityMultipler: number, applyMaxDurabilityDegradation?: boolean): void; + protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number, traderQualityMultipler: number): number; + protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, weaponMax: number, traderQualityMultipler: number): number; isWeaponTemplate(tpl: string): boolean; } diff --git a/Live/CWX_DeSharpener/server/dist/types/helpers/TradeHelper.d.ts b/Live/CWX_DeSharpener/server/dist/types/helpers/TradeHelper.d.ts index 975062b..7ab9768 100644 --- a/Live/CWX_DeSharpener/server/dist/types/helpers/TradeHelper.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/helpers/TradeHelper.d.ts @@ -39,6 +39,12 @@ export declare class TradeHelper { * @returns */ sellItem(pmcData: IPmcData, body: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Increment the assorts buy count by number of items purchased + * Show error on screen if player attepts 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; protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/Live/CWX_DeSharpener/server/dist/types/helpers/TraderAssortHelper.d.ts b/Live/CWX_DeSharpener/server/dist/types/helpers/TraderAssortHelper.d.ts index 91ba6b9..025efd6 100644 --- a/Live/CWX_DeSharpener/server/dist/types/helpers/TraderAssortHelper.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/helpers/TraderAssortHelper.d.ts @@ -1,7 +1,7 @@ import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator"; import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; import { Item } from "../models/eft/common/tables/IItem"; -import { ITraderAssort } from "../models/eft/common/tables/ITrader"; +import { ITrader, ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -10,13 +10,16 @@ import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; +import { TimeUtil } from "../utils/TimeUtil"; import { AssortHelper } from "./AssortHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class TraderAssortHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; protected mathUtil: MathUtil; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected assortHelper: AssortHelper; @@ -24,18 +27,32 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts + * Filter out assorts not unlocked due to level OR quest completion * @param sessionId session id - * @param traderId trader id - * @returns a traders assorts + * @param traderId traders id + * @returns a traders' assorts */ - getAssort(sessionId: string, traderId: string): ITraderAssort; + getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset a traders assorts and move nextResupply value to future + * Flag trader as needing a flea offer reset to be picked up by flea update() function + * @param trader trader details to alter + */ + resetExpiredTrader(trader: ITrader): void; + /** + * Does the supplied trader need its assorts refreshed + * @param traderID Trader to check + * @returns true they need refreshing + */ + traderAssortsHaveExpired(traderID: string): boolean; /** * Iterate over all assorts barter_scheme values, find barters selling for money and multiply by multipler in config * @param traderAssort Assorts to multiple price of diff --git a/Live/CWX_DeSharpener/server/dist/types/helpers/TraderHelper.d.ts b/Live/CWX_DeSharpener/server/dist/types/helpers/TraderHelper.d.ts index b2e9d38..0dc93e8 100644 --- a/Live/CWX_DeSharpener/server/dist/types/helpers/TraderHelper.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/helpers/TraderHelper.d.ts @@ -9,6 +9,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { PlayerService } from "../services/PlayerService"; +import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -23,9 +24,10 @@ export declare class TraderHelper { protected handbookHelper: HandbookHelper; protected playerService: PlayerService; protected fenceService: FenceService; + protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -63,7 +65,7 @@ export declare class TraderHelper { * @param item * @returns boolean */ - protected isWeaponAndBelowTraderBuyDurability(traderID: string, item: Item): boolean; + protected isWeaponBelowTraderBuyDurability(traderID: string, item: Item): boolean; /** * Get the price of an item and all of its attached children * Take into account bonuses/adjsutments e.g. discounts @@ -97,6 +99,17 @@ export declare class TraderHelper { * @param sessionID session id */ lvlUp(traderID: string, sessionID: string): void; + /** + * Get the next update timestamp for a trader + * @param traderID Trader to look up update value for + * @returns future timestamp + */ + getNextUpdateTimestamp(traderID: string): number; + /** + * Get the reset time between trader assort refreshes in seconds + * @param traderId Trader to look up + * @returns Time in seconds + */ getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader diff --git a/Live/CWX_DeSharpener/server/dist/types/loaders/PreAkiModLoader.d.ts b/Live/CWX_DeSharpener/server/dist/types/loaders/PreAkiModLoader.d.ts index 6ded3c6..4ab1689 100644 --- a/Live/CWX_DeSharpener/server/dist/types/loaders/PreAkiModLoader.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/loaders/PreAkiModLoader.d.ts @@ -33,9 +33,20 @@ export declare class PreAkiModLoader implements IModLoader { protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; /** - * - * @param mods Get an array of broken/invalid mods by name - * @returns Mod names array + * Check for duplciate mods loaded, show error if duplicate mod found + * @param modPackageData dictionary of mod package.json data + */ + protected checkForDuplicateMods(modPackageData: Record): void; + /** + * Check for and return duplicate strings inside an array + * @param stringArray Array to check for duplicates + * @returns string array of duplicates, empty if none found + */ + protected getDuplicates(stringArray: string[]): string[]; + /** + * Get an array of mods with errors that prevent them from working with SPT + * @param mods mods to validate + * @returns Mod names as array */ protected getBrokenMods(mods: string[]): string[]; /** @@ -57,7 +68,12 @@ export declare class PreAkiModLoader implements IModLoader { protected addMod(mod: string): Promise; protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record): boolean; protected isModCompatible(mod: IPackageJsonData, loadedMods: Record): boolean; - protected validMod(mod: string): boolean; + /** + * Validate a mod passes a number of checks + * @param modName name of mod in /mods/ to validate + * @returns true if valid + */ + protected validMod(modName: string): boolean; protected getLoadOrderRecursive(mod: string, result: Record, visited: Record): void; protected getLoadOrder(mods: Record): Record; getContainer(): DependencyContainer; diff --git a/Live/CWX_DeSharpener/server/dist/types/models/eft/common/IGlobals.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/eft/common/IGlobals.d.ts index 9d28dbc..81e2023 100644 --- a/Live/CWX_DeSharpener/server/dist/types/models/eft/common/IGlobals.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/models/eft/common/IGlobals.d.ts @@ -1175,5 +1175,6 @@ export interface Preset { _name: string; _parent: string; _items: Item[]; + /** Default presets have this property */ _encyclopedia?: string; } diff --git a/Live/CWX_DeSharpener/server/dist/types/models/eft/common/ILocationBase.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/eft/common/ILocationBase.d.ts index b1dd448..78ade9a 100644 --- a/Live/CWX_DeSharpener/server/dist/types/models/eft/common/ILocationBase.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/models/eft/common/ILocationBase.d.ts @@ -137,7 +137,7 @@ export interface BotLocationModifier { VisibleDistance: number; } export interface MinMaxBot { - WildSpawnType: string; + WildSpawnType: WildSpawnType; max: number; min: number; } @@ -195,7 +195,7 @@ export interface Wave { BotPreset: string; BotSide: string; SpawnPoints: string; - WildSpawnType: string; + WildSpawnType: WildSpawnType; isPlayers: boolean; number: number; slots_max: number; @@ -203,3 +203,7 @@ export interface Wave { time_max: number; time_min: number; } +export declare enum WildSpawnType { + ASSAULT = "assault", + MARKSMAN = "marksman" +} diff --git a/Live/CWX_DeSharpener/server/dist/types/models/eft/common/tables/IBotBase.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/eft/common/tables/IBotBase.d.ts index 0ee468e..25cb861 100644 --- a/Live/CWX_DeSharpener/server/dist/types/models/eft/common/tables/IBotBase.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/models/eft/common/tables/IBotBase.d.ts @@ -28,6 +28,8 @@ export interface IBotBase { CarExtractCounts: CarExtractCounts; SurvivorClass: SurvivorClass; WishList: string[]; + /** SPT specific property used during bot generation in raid */ + sptIsPmc?: boolean; } export interface Info { EntryPoint: string; @@ -66,13 +68,13 @@ export interface IBan { dateTime: number; } export declare enum BanType { - Chat = 0, - RagFair = 1, - Voip = 2, - Trading = 3, - Online = 4, - Friends = 5, - ChangeNickname = 6 + CHAT = 0, + RAGFAIR = 1, + VOIP = 2, + TRADING = 3, + ONLINE = 4, + FRIENDS = 5, + CHANGE_NICKNAME = 6 } export interface Customization { Head: string; @@ -312,11 +314,11 @@ export interface Notes { export interface CarExtractCounts { } export declare enum SurvivorClass { - Unknown = 0, - Neutralizer = 1, - Marauder = 2, - Paramedic = 3, - Survivor = 4 + UNKNOWN = 0, + NEUTRALIZER = 1, + MARAUDER = 2, + PARAMEDIC = 3, + SURVIVOR = 4 } export interface Quest { qid: string; diff --git a/Live/CWX_DeSharpener/server/dist/types/models/eft/common/tables/ITemplateItem.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/eft/common/tables/ITemplateItem.d.ts index 23a1a14..8569e61 100644 --- a/Live/CWX_DeSharpener/server/dist/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/models/eft/common/tables/ITemplateItem.d.ts @@ -34,6 +34,7 @@ export interface Props { LootExperience?: number; ExamineExperience?: number; HideEntrails?: boolean; + InsuranceDisabled?: boolean; RepairCost?: number; RepairSpeed?: number; ExtraSizeLeft?: number; @@ -79,7 +80,7 @@ export interface Props { HasShoulderContact?: boolean; SightingRange?: number; DoubleActionAccuracyPenaltyMult?: number; - ModesCount: any; + ModesCount?: any; DurabilityBurnModificator?: number; HeatFactor?: number; CoolFactor?: number; @@ -155,7 +156,7 @@ export interface Props { RigLayoutName?: string; MaxDurability?: number; armorZone?: string[]; - armorClass: any; + armorClass?: any; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -206,6 +207,7 @@ export interface Props { IsOneoff?: boolean; MustBoltBeOpennedForExternalReload?: boolean; MustBoltBeOpennedForInternalReload?: boolean; + NoFiremodeOnBoltcatch?: boolean; BoltAction?: boolean; HipAccuracyRestorationDelay?: number; HipAccuracyRestorationSpeed?: number; @@ -252,8 +254,8 @@ export interface Props { foodUseTime?: number; foodEffectType?: string; StimulatorBuffs?: string; - effects_health: any; - effects_damage: any; + effects_health?: any; + effects_damage?: any; MaximumNumberOfUsage?: number; knifeHitDelay?: number; knifeHitSlashRate?: number; diff --git a/Live/CWX_DeSharpener/server/dist/types/models/eft/common/tables/ITrader.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/eft/common/tables/ITrader.d.ts index f0fe2b5..37b2d61 100644 --- a/Live/CWX_DeSharpener/server/dist/types/models/eft/common/tables/ITrader.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/models/eft/common/tables/ITrader.d.ts @@ -7,7 +7,7 @@ export interface ITrader { suits?: ISuit[]; } export interface ITraderBase { - refreshAssort: boolean; + refreshTraderRagfairOffers: boolean; _id: string; avatar: string; balance_dol: number; @@ -58,7 +58,7 @@ export interface Repair { quality: string; } export interface ITraderAssort { - nextResupply?: number; + nextResupply: number; items: Item[]; barter_scheme: Record; loyal_level_items: Record; @@ -67,6 +67,7 @@ export interface IBarterScheme { count: number; _tpl: string; onlyFunctional?: boolean; + sptQuestLocked?: boolean; } export interface ISuit { _id: string; diff --git a/Live/CWX_DeSharpener/server/dist/types/models/eft/health/Effect.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/eft/health/Effect.d.ts index 2f0adac..7eb3ffc 100644 --- a/Live/CWX_DeSharpener/server/dist/types/models/eft/health/Effect.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/models/eft/health/Effect.d.ts @@ -1,5 +1,5 @@ export declare enum Effect { - Fracture = "Fracture", - LightBleeding = "LightBleeding", - HeavyBleeding = "HeavyBleeding" + FRACTURE = "Fracture", + LIGHT_BLEEDING = "LightBleeding", + HEAVY_BLEEDING = "HeavyBleeding" } diff --git a/Live/CWX_DeSharpener/server/dist/types/models/eft/health/IOffraidHealRequestData.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/eft/health/IOffraidHealRequestData.d.ts index c242300..26b02bd 100644 --- a/Live/CWX_DeSharpener/server/dist/types/models/eft/health/IOffraidHealRequestData.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/models/eft/health/IOffraidHealRequestData.d.ts @@ -7,12 +7,12 @@ export interface IOffraidHealRequestData extends IBaseInteractionRequestData { time: number; } export declare enum BodyPart { - Head = 0, - Chest = 1, - Stomach = 2, - LeftArm = 3, - RightArm = 4, - LeftLeg = 5, - RightLeg = 6, - Common = 7 + HEAD = "Head", + CHEST = "Chest", + STOMACH = "Stomach", + LEFT_ARM = "LeftArm", + RIGHT_ARM = "RightArm", + LEFT_LEG = "LeftLeg", + RIGHT_LEG = "RightLeg", + COMMON = "Common" } diff --git a/Live/CWX_DeSharpener/server/dist/types/models/eft/notifier/INotifier.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/eft/notifier/INotifier.d.ts index 8c48260..b248636 100644 --- a/Live/CWX_DeSharpener/server/dist/types/models/eft/notifier/INotifier.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/models/eft/notifier/INotifier.d.ts @@ -1,9 +1,9 @@ export interface INotifierChannel { - "server": string; - "channel_id": string; - "url": string; - "notifierServer": string; - "ws": string; + server: string; + channel_id: string; + url: string; + notifierServer: string; + ws: string; } import { Message } from "../profile/IAkiProfile"; export interface INotification { diff --git a/Live/CWX_DeSharpener/server/dist/types/models/eft/ragfair/IRagfairOffer.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/eft/ragfair/IRagfairOffer.d.ts index 63f655e..141b605 100644 --- a/Live/CWX_DeSharpener/server/dist/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -15,6 +15,8 @@ export interface IRagfairOffer { name?: string; shortName?: string; loyaltyLevel: number; + buyRestrictionMax?: number; + buyRestrictionCurrent?: number; locked: boolean; unlimitedCount: boolean; summaryCost: number; diff --git a/Live/CWX_DeSharpener/server/dist/types/models/enums/AmmoTypes.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/enums/AmmoTypes.d.ts index b52ddcf..254b410 100644 --- a/Live/CWX_DeSharpener/server/dist/types/models/enums/AmmoTypes.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/models/enums/AmmoTypes.d.ts @@ -23,7 +23,7 @@ export declare enum Ammo762x54 { BT_GZH = "5e023d34e8a400319a28ed44", BS_GZH = "5e023d48186a883be655e551" } -export declare enum Ammo338Lapua { +export declare enum Ammo86x70 { TAC_X = "5fc382b6d6fa9c00c571bbc3", UCW = "5fc382c1016cce60e8341b20", AP = "5fc382a9d724d907e2077dab", @@ -85,13 +85,13 @@ export declare enum Ammo9x21 { PE_GZH = "5a26ac06c4a282000c5a90a8", BT_GZH = "5a26ac0ec4a28200741e1e18" } -export declare enum Ammo357Mag { +export declare enum Ammo9x33R { FMJ = "62330b3ed4dc74626d570b95", HOLLOW_POINT = "62330bfadc5883093563729b", SOFT_POINT = "62330c40bdd19b369e1e53d1", JACKET_HP = "62330c18744e5e31df12f516" } -export declare enum Ammo45ACP { +export declare enum Ammo1143x23ACP { MATCH_FMJ = "5e81f423763d9f754677bf2e", HYDRA_SHOK = "5efb0fc6aeb21837e749c801", LASERMATCH_FMJ = "5efb0d4f4bc50b58e81710f3", @@ -126,7 +126,7 @@ export declare enum Ammo556x45 { MK_318_MOD_0_SOST = "60194943740c5d77f6705eea", SSA_AP = "601949593ae8f707c4608daa" } -export declare enum Ammo300Blackout { +export declare enum Ammo762x35 { M62_TRACER = "619636be6db0f2477964e710", BCP_FMJ = "5fbe3ffdf8b6a877a729ea82", AP = "5fd20ff893a8961fc660a954", diff --git a/Live/CWX_DeSharpener/server/dist/types/models/enums/BaseClasses.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/enums/BaseClasses.d.ts index e733bca..36ebc71 100644 --- a/Live/CWX_DeSharpener/server/dist/types/models/enums/BaseClasses.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/models/enums/BaseClasses.d.ts @@ -25,6 +25,7 @@ export declare enum BaseClasses { SIGHTS = "5448fe7a4bdc2d6f028b456b", MEDS = "543be5664bdc2dd4348b4569", MONEY = "543be5dd4bdc2deb348b4569", + NIGHTVISION = "5a2c3a9486f774688b05e574", KEY = "543be5e94bdc2df1348b4568", KEY_MECHANICAL = "5c99f98d86f7745c314214b3", KEYCARD = "5c164d2286f774194c5e69fa", @@ -66,8 +67,8 @@ export declare enum BaseClasses { LUBRICANT = "57864e4c24597754843f8723", BATTERY = "57864ee62459775490116fc1", ASSAULT_SCOPE = "55818add4bdc2d5b648b456f", - REFLEX_SIGHT = "55818ad54bdc2ddc698b4569", TACTICAL_COMBO = "55818b164bdc2ddc698b456c", + FLASHLIGHT = "55818b084bdc2d5b648b4571", MAGAZINE = "5448bc234bdc2d3c308b4569", LIGHT_LASER = "55818b0e4bdc2dde698b456e", FLASH_HIDER = "550aa4bf4bdc2dd6348b456b", diff --git a/Live/CWX_DeSharpener/server/dist/types/models/enums/BotAmount.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/enums/BotAmount.d.ts index d0e1df1..9ef9cab 100644 --- a/Live/CWX_DeSharpener/server/dist/types/models/enums/BotAmount.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/models/enums/BotAmount.d.ts @@ -1,7 +1,7 @@ export declare enum BotAmount { - AsOnline = "AsOnline", - Low = "Low", - Medium = "Medium", - High = "High", - Horde = "Horde" + AS_ONLINE = "AsOnline", + LOW = "Low", + MEDIUM = "Medium", + HIGH = "High", + HORDE = "Horde" } diff --git a/Live/CWX_DeSharpener/server/dist/types/models/enums/BotDifficulty.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/enums/BotDifficulty.d.ts index c901bcf..80e45ad 100644 --- a/Live/CWX_DeSharpener/server/dist/types/models/enums/BotDifficulty.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/models/enums/BotDifficulty.d.ts @@ -1,8 +1,8 @@ export declare enum BotDifficulty { - AsOnline = "AsOnline", - Easy = "Easy", - Medium = "Medium", - Hard = "Hard", - Impossible = "Impossible", - Random = "Random" + AS_ONLINE = "AsOnline", + EASY = "Easy", + MEDIUM = "Medium", + HARD = "Hard", + IMPOSSIBLE = "Impossible", + RANDOM = "Random" } diff --git a/Live/CWX_DeSharpener/server/dist/types/models/enums/ConfigTypes.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/enums/ConfigTypes.d.ts index 61d6f99..468ece5 100644 --- a/Live/CWX_DeSharpener/server/dist/types/models/enums/ConfigTypes.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/models/enums/ConfigTypes.d.ts @@ -8,6 +8,7 @@ export declare enum ConfigTypes { IN_RAID = "aki-inraid", INSURANCE = "aki-insurance", INVENTORY = "aki-inventory", + ITEM = "aki-item", LOCALE = "aki-locale", LOCATION = "aki-location", MATCH = "aki-match", diff --git a/Live/CWX_DeSharpener/server/dist/types/models/enums/ELocationName.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/enums/ELocationName.d.ts index b56cc08..7ae7caa 100644 --- a/Live/CWX_DeSharpener/server/dist/types/models/enums/ELocationName.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/models/enums/ELocationName.d.ts @@ -1,5 +1,6 @@ export declare enum ELocationName { FACTORY_DAY = "factory4_day", + FACTORY_NIGHT = "factory4_night", BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", diff --git a/Live/CWX_DeSharpener/server/dist/types/models/enums/MemberCategory.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/enums/MemberCategory.d.ts index 3bd9a21..a81380e 100644 --- a/Live/CWX_DeSharpener/server/dist/types/models/enums/MemberCategory.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/models/enums/MemberCategory.d.ts @@ -1,13 +1,13 @@ export declare enum MemberCategory { - Default = 0, - Developer = 1, - UniqueId = 2, - Trader = 4, - Group = 8, - System = 16, - ChatModerator = 32, - ChatModeratorWithPermanentBan = 64, - UnitTest = 128, - Sherpa = 256, - Emissary = 512 + DEFAULT = 0, + DEVELOPER = 1, + UNIQUE_ID = 2, + TRADER = 4, + GROUP = 8, + SYSTEM = 16, + CHAT_MODERATOR = 32, + CHAT_MODERATOR_WITH_PERMANENT_BAN = 64, + UNIT_TEST = 128, + SHERPA = 256, + EMISSARY = 512 } diff --git a/Live/CWX_DeSharpener/server/dist/types/models/enums/QuestRewardType.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/enums/QuestRewardType.d.ts index 1d3db86..16f7e39 100644 --- a/Live/CWX_DeSharpener/server/dist/types/models/enums/QuestRewardType.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/models/enums/QuestRewardType.d.ts @@ -1,8 +1,8 @@ export declare enum QuestRewardType { - Skill = "Skill", - Experience = "Experience", - TraderStanding = "TraderStanding", - TraderUnlock = "TraderUnlock", - Item = "Item", - AssortmentUnlock = "AssortmentUnlock" + SKILL = "Skill", + EXPERIENCE = "Experience", + TRADER_STANDING = "TraderStanding", + TRADER_UNLOCK = "TraderUnlock", + ITEM = "Item", + ASSORTMENT_UNLOCK = "AssortmentUnlock" } diff --git a/Live/CWX_DeSharpener/server/dist/types/models/enums/RaidMode.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/enums/RaidMode.d.ts index c5a8cff..e20cf3f 100644 --- a/Live/CWX_DeSharpener/server/dist/types/models/enums/RaidMode.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/models/enums/RaidMode.d.ts @@ -1,5 +1,5 @@ export declare enum RaidMode { - Online = "Online", - Local = "Local", - Coop = "Coop" + ONLINE = "Online", + LOCAL = "Local", + COOP = "Coop" } diff --git a/Live/CWX_DeSharpener/server/dist/types/models/enums/WeaponTypes.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/enums/WeaponTypes.d.ts new file mode 100644 index 0000000..867b052 --- /dev/null +++ b/Live/CWX_DeSharpener/server/dist/types/models/enums/WeaponTypes.d.ts @@ -0,0 +1,151 @@ +export declare enum Weapons127x55 { + ASH_12 = "5cadfbf7ae92152ac412eeef" +} +export declare enum Weapons86x70 { + MK_18 = "5fc22d7c187fea44d52eda44", + AXMC = "627e14b21713922ded6f2c15" +} +export declare enum Weapons9x39 { + AS_VAL = "57c44b372459772d2b39b8ce", + VSS_VINTOREZ = "57838ad32459774a17445cd2" +} +export declare enum Weapons762x54R { + SVDS = "5c46fbd72e2216398b5a8c9c", + MP_18 = "61f7c9e189e6fb1a5e3ea78d", + MOSIN_INFANTRY = "5bfd297f0db834001a669119", + MOSIN_SNIPER = "5ae08f0a5acfc408fb1398a1", + SV_98 = "55801eed4bdc2d89578b4588" +} +export declare enum Weapons762x51 { + VPO_101 = "5c501a4d2e221602b412b540", + DT_MDR_762 = "5dcbd56fdbd3d91b3e5468d5", + SA_58 = "5b0bbe4e5acfc40dc528a72d", + SCARH_BLACK = "6183afd850224f204c1da514", + SCARH_FDE = "6165ac306ef05c2ce828ef74", + HK_G28 = "6176aca650224f204c1da3fb", + M1A = "5aafa857e5b5b00018480968", + RFB = "5f2a9575926fd9352339381f", + RSASS = "5a367e5dc4a282000e49738f", + SR_25 = "5df8ce05b11454561e39243b", + DVL_10 = "588892092459774ac91d4b11", + M700 = "5bfea6e90db834001b7347f3", + T5000M = "5df24cf80dee1b22f862e9bc" +} +export declare enum Weapons366TKM { + VPO_209 = "59e6687d86f77411d949b251", + VPO_215 = "5de652c31b7e3716273428be" +} +export declare enum Weapons762x39 { + OP_SKS = "587e02ff24597743df3deaeb", + SKS = "574d967124597745970e7c94", + AK_103 = "5ac66d2e5acfc43b321d4b53", + AK_104 = "5ac66d725acfc43b321d4b60", + AKM = "59d6088586f774275f37482f", + AKMN = "5a0ec13bfcdbcb00165aa685", + AKMS = "59ff346386f77477562ff5e2", + AKMSN = "5abcbc27d8ce8700182eceeb", + MK47_MUTANT = "606587252535c57a13424cfd", + RD_704 = "628a60ae6b1d481ff772e9c8", + VPO_136 = "59e6152586f77473dc057aa1" +} +export declare enum Weapons762x35 { + MCX = "5fbcc1d9016cce60e8341ab3" +} +export declare enum Weapons556x45 { + ADAR_2_15 = "5c07c60e0db834002330051f", + AK_101 = "5ac66cb05acfc40198510a10", + AK_102 = "5ac66d015acfc400180ae6e4", + DT_MDR_556 = "5c488a752e221602b412af63", + HK_416A5 = "5bb2475ed4351e00853264e3", + HK_G36 = "623063e994fc3f7b302a9696", + M4A1 = "5447a9cd4bdc2dbd208b4567", + SCARL_BLACK = "6184055050224f204c1da540", + SCARL_FDE = "618428466ef05c2ce828f218", + TX15_DML = "5d43021ca4b9362eab4b5e25" +} +export declare enum Weapons545x39 { + AK_105 = "5ac66d9b5acfc4001633997a", + AK_74 = "5bf3e03b0db834001d2c4a9c", + AK_74M = "5ac4cd105acfc40016339859", + AK_74N = "5644bd2b4bdc2d3b4c8b4572", + AKS_74 = "5bf3e0490db83400196199af", + AKS_74N = "5ab8e9fcd8ce870019439434", + AKS_74U = "57dc2fa62459775949412633", + AKS_74UB = "5839a40f24597726f856b511", + AKS_74UN = "583990e32459771419544dd2", + SAG_AK = "628b5638ad252a16da6dd245", + SAG_AK_SHORT = "628b9c37a733087d0d7fe84b", + RPK_16 = "5beed0f50db834001c062b12" +} +export declare enum Weapons57x28FN { + FN_57_BLACK = "5d3eb3b0a4b93615055e84d2", + FN_57_FDE = "5d67abc1a4b93614ec50137f", + FN_P90 = "5cc82d76e24e8d00134b4b83" +} +export declare enum Weapons46x30HK { + MP7A1 = "5ba26383d4351e00334c93d9", + MP7A2 = "5bd70322209c4d00d7167b8f" +} +export declare enum Weapons1143x23 { + M1911A1 = "5e81c3cbac2bb513793cdc75", + M45A1 = "5f36a0e5fbf956000b716b65", + USP45 = "6193a720f8ee7e52e42109ed", + UMP45 = "5fc3e272f8b6a877a729eac5", + VECTOR45 = "5fb64bc92b1b027b1f50bcf2" +} +export declare enum Weapons9x33R { + CR_50DS = "61a4c8884f95bc3b2c5dc96f" +} +export declare enum Weapons9x21 { + SR_1MP = "59f98b4986f7746f546d2cef" +} +export declare enum Weapons9x19 { + GLOCK_17 = "5a7ae0c351dfba0017554310", + GLOCK_18C = "5b1fa9b25acfc40018633c01", + M9A3 = "5cadc190ae921500103bb3b6", + MP_443 = "576a581d2459771e7b1bc4f1", + P226R = "56d59856d2720bd8418b456a", + PL_15 = "602a9740da11d6478d5a06dc", + CR_200DS = "624c2e8614da335f1e034d8c", + MP5 = "5926bb2186f7744b1c6c6e60", + MP5K = "5d2f0d8048f0356c925bc3b0", + MP9 = "5e00903ae9dc277128008b87", + MP9_N = "5de7bd7bfd6b4e6e2276dc25", + MPX = "58948c8e86f77409493f7266", + PP_19_01 = "59984ab886f7743e98271174", + SAIGA_9 = "59f9cabd86f7743a10721f46", + STM_9 = "60339954d62c9b14ed777c06", + VECTOR_9MM = "5fc3f2d5900b1d5091531e57" +} +export declare enum Weapons9x18 { + APB = "5abccb7dd8ce87001773e277", + APS = "5a17f98cfcdbcb0980087290", + PB_SILENCED = "56e0598dd2720bb5668b45a6", + PM = "5448bd6b4bdc2dfc2f8b4569", + PM_T = "579204f224597773d619e051", + PP9_KLIN = "57f4c844245977379d5c14d1", + PP91_KEDR = "57d14d2524597714373db789", + PP91_KEDRB = "57f3c6bd24597738e730fa2f" +} +export declare enum Weapons762x25 { + TT = "571a12c42459771f627b58a0", + TT_GOLD = "5b3b713c5acfc4330140bd8d", + PPSH_41 = "5ea03f7400685063ec28bfa8" +} +export declare enum Weapons12Gauge { + M3_SUPER90 = "6259b864ebedf17603599e88", + M590A1 = "5e870397991fd70db46995c8", + M870 = "5a7828548dc32e5a9c28b516", + MP_133 = "54491c4f4bdc2db1078b4568", + MP_153 = "56dee2bdd2720bc8328b4567", + MP_155 = "606dae0ab0e443224b421bb7", + MP_43_1C = "5580223e4bdc2d1c128b457f", + MTS_255_12 = "60db29ce99594040e04c4a27", + SAIGA_12GA = "576165642459773c7a400233" +} +export declare enum Weapons20Gauge { + TOZ_106 = "5a38e6bac4a2826c6e06d79b" +} +export declare enum Weapons23x75 { + KS_23M = "5e848cc2988a8701445df1e8" +} diff --git a/Live/CWX_DeSharpener/server/dist/types/models/spt/bots/BotLootCache.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/spt/bots/BotLootCache.d.ts index e185315..aedf7b0 100644 --- a/Live/CWX_DeSharpener/server/dist/types/models/spt/bots/BotLootCache.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/models/spt/bots/BotLootCache.d.ts @@ -11,13 +11,13 @@ export declare class BotLootCache { grenadeItems: ITemplateItem[]; } export declare enum LootCacheType { - Special = "Special", - Backpack = "Backpack", - Pocket = "Pocket", - Vest = "Vest", - Combined = "Combined", - HealingItems = "HealingItems", - DrugItems = "DrugItems", - StimItems = "StimItems", - GrenadeItems = "GrenadeItems" + SPECIAL = "Special", + BACKPACK = "Backpack", + POCKET = "Pocket", + VEST = "Vest", + COMBINED = "Combined", + HEALING_ITEMS = "HealingItems", + DRUG_ITEMS = "DrugItems", + STIM_ITEMS = "StimItems", + GRENADE_ITEMS = "GrenadeItems" } diff --git a/Live/CWX_DeSharpener/server/dist/types/models/spt/config/IAirdropConfig.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/spt/config/IAirdropConfig.d.ts index f4aee89..3edcbdd 100644 --- a/Live/CWX_DeSharpener/server/dist/types/models/spt/config/IAirdropConfig.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/models/spt/config/IAirdropConfig.d.ts @@ -1,14 +1,14 @@ +import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IAirdropConfig extends IBaseConfig { kind: "aki-airdrop"; airdropChancePercent: AirdropChancePercent; - airdropMinOpenHeight: number; - airdropMaxOpenHeight: number; planeMinFlyHeight: number; planeMaxFlyHeight: number; planeVolume: number; airdropMinStartTimeSeconds: number; airdropMaxStartTimeSeconds: number; + loot: AirdropLoot; } export interface AirdropChancePercent { bigmap: number; @@ -18,3 +18,13 @@ export interface AirdropChancePercent { interchange: number; reserve: number; } +export interface AirdropLoot { + presetCount: MinMax; + itemCount: MinMax; + itemBlacklist: string[]; + itemTypeWhitelist: string[]; + /** key: item base type: value: max count */ + itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; +} diff --git a/Live/CWX_DeSharpener/server/dist/types/models/spt/config/IBotConfig.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/spt/config/IBotConfig.d.ts index e171087..af8ceba 100644 --- a/Live/CWX_DeSharpener/server/dist/types/models/spt/config/IBotConfig.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/models/spt/config/IBotConfig.d.ts @@ -1,17 +1,31 @@ import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; +import { IBotDurability } from "./IBotDurability"; +import { IPmcConfig } from "./IPmcConfig"; export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; + /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** What bot types should be classified as bosses */ bosses: string[]; - durability: Durability; + /** Control weapon/armor durability min/max values for each bot type */ + durability: IBotDurability; + /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ lootNValue: LootNvalue; + /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; - pmc: PmcConfig; + /** PMC bot specific config settings */ + pmc: IPmcConfig; + /** Control how many items are allowed to spawn on a bot + * key: bottype, value: */ itemSpawnLimits: Record>; - equipment: Record; + /** Blacklist/whitelist items on a bot */ + equipment: Record; + /** Show a bots botType value after their name */ showTypeInNickname: boolean; - maxBotCap: number; + /** Max number of bots that can be spawned in a raid at any one time */ + maxBotCap: Record; + /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; } export interface PresetBatch { @@ -44,79 +58,23 @@ export interface PresetBatch { test: number; exUsec: number; } -export interface Durability { - default: DefaultDurability; - pmc: PmcDurability; - boss: BotDurability; - follower: BotDurability; - assault: BotDurability; - cursedassault: BotDurability; - marksman: BotDurability; - pmcbot: BotDurability; - exusec: BotDurability; - sectantpriest: BotDurability; - sectantwarrior: BotDurability; -} -export interface DefaultDurability { - armor: DefaultArmor; - weapon: WeaponDurability; -} -export interface DefaultArmor { - maxDelta: number; - minDelta: number; -} -export interface WeaponDurability { - lowestMax: number; - highestMax: number; - maxDelta: number; - minDelta: number; -} -export interface PmcDurability { - armor: PmcDurabilityArmor; - weapon: WeaponDurability; -} -export interface PmcDurabilityArmor { - lowestMaxPercent: number; - highestMaxPercent: number; - maxDelta: number; - minDelta: number; -} -export interface BotDurability { - armor: ArmorDurability; - weapon: WeaponDurability; -} -export interface ArmorDurability { - maxDelta: number; - minDelta: number; -} export interface LootNvalue { scav: number; pmc: number; } -export interface PmcConfig { - dynamicLoot: PmcDynamicLoot; - difficulty: string; - looseWeaponInBackpackChancePercent: number; - looseWeaponInBackpackLootMinMax: MinMax; - isUsec: number; - chanceSameSideIsHostilePercent: number; - usecType: string; - bearType: string; - maxBackpackLootTotalRub: number; - maxPocketLootTotalRub: number; - maxVestLootTotalRub: number; - convertIntoPmcChance: Record; - enemyTypes: string[]; -} -export interface PmcDynamicLoot { - whitelist: string[]; - blacklist: string[]; - moneyStackLimits: Record; -} -export interface Equipment { +export interface EquipmentFilters { + weaponModLimits: ModLimits; + randomisedWeaponModSlots?: string[]; + randomisedArmorSlots?: string[]; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; } +export interface ModLimits { + /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ + scopeLimit?: number; + /** How many lasers or lights are allowed on a weapon - hard coded to work with TACTICAL_COMBO, and FLASHLIGHT */ + lightLaserLimit?: number; +} export interface EquipmentFilterDetails { levelRange: MinMax; equipment: Record; diff --git a/Live/CWX_DeSharpener/server/dist/types/models/spt/config/IBotDurability.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/spt/config/IBotDurability.d.ts new file mode 100644 index 0000000..38a47cc --- /dev/null +++ b/Live/CWX_DeSharpener/server/dist/types/models/spt/config/IBotDurability.d.ts @@ -0,0 +1,47 @@ +export interface IBotDurability { + default: DefaultDurability; + pmc: PmcDurability; + boss: BotDurability; + follower: BotDurability; + assault: BotDurability; + cursedassault: BotDurability; + marksman: BotDurability; + pmcbot: BotDurability; + exusec: BotDurability; + gifter: BotDurability; + sectantpriest: BotDurability; + sectantwarrior: BotDurability; +} +/** Durability values to be used when a more specific bot type cant be found */ +export interface DefaultDurability { + armor: DefaultArmor; + weapon: WeaponDurability; +} +export interface DefaultArmor { + maxDelta: number; + minDelta: number; +} +export interface WeaponDurability { + lowestMax: number; + highestMax: number; + maxDelta: number; + minDelta: number; +} +export interface PmcDurability { + armor: PmcDurabilityArmor; + weapon: WeaponDurability; +} +export interface PmcDurabilityArmor { + lowestMaxPercent: number; + highestMaxPercent: number; + maxDelta: number; + minDelta: number; +} +export interface BotDurability { + armor: ArmorDurability; + weapon: WeaponDurability; +} +export interface ArmorDurability { + maxDelta: number; + minDelta: number; +} diff --git a/Live/CWX_DeSharpener/server/dist/types/models/spt/config/IHideoutConfig.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/spt/config/IHideoutConfig.d.ts index 36d6246..f232052 100644 --- a/Live/CWX_DeSharpener/server/dist/types/models/spt/config/IHideoutConfig.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/models/spt/config/IHideoutConfig.d.ts @@ -2,6 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; runIntervalSeconds: number; - fuelDrainRateMultipler: number; hoursForSkillCrafting: number; + generatorSpeedWithoutFuel: number; + generatorFuelFlowRate: number; + airFilterUnitFlowRate: number; + /** SEE HIDEOUTHELPER BEFORE CHANGING CONFIG */ + gpuBoostRate: number; } diff --git a/Live/CWX_DeSharpener/server/dist/types/models/spt/config/IItemConfig.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/spt/config/IItemConfig.d.ts new file mode 100644 index 0000000..5ecccc2 --- /dev/null +++ b/Live/CWX_DeSharpener/server/dist/types/models/spt/config/IItemConfig.d.ts @@ -0,0 +1,5 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface IItemConfig extends IBaseConfig { + kind: "aki-item"; + blacklist: string[]; +} diff --git a/Live/CWX_DeSharpener/server/dist/types/models/spt/config/IPmcConfig.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/spt/config/IPmcConfig.d.ts new file mode 100644 index 0000000..9db2ba1 --- /dev/null +++ b/Live/CWX_DeSharpener/server/dist/types/models/spt/config/IPmcConfig.d.ts @@ -0,0 +1,26 @@ +import { MinMax } from "../../common/MinMax"; +export interface IPmcConfig { + dynamicLoot: DynamicLoot; + useDifficultyOverride: boolean; + difficulty: string; + looseWeaponInBackpackChancePercent: number; + looseWeaponInBackpackLootMinMax: MinMax; + isUsec: number; + chanceSameSideIsHostilePercent: number; + /** key: location, value: type for usec/bear */ + pmcType: Record; + maxBackpackLootTotalRub: number; + maxPocketLootTotalRub: number; + maxVestLootTotalRub: number; + convertIntoPmcChance: Record; + enemyTypes: string[]; +} +export interface PmcTypes { + usec: string; + bear: string; +} +export interface DynamicLoot { + whitelist: string[]; + blacklist: string[]; + moneyStackLimits: Record; +} diff --git a/Live/CWX_DeSharpener/server/dist/types/models/spt/config/IQuestConfig.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/spt/config/IQuestConfig.d.ts index be4a97b..45c9aae 100644 --- a/Live/CWX_DeSharpener/server/dist/types/models/spt/config/IQuestConfig.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/models/spt/config/IQuestConfig.d.ts @@ -4,6 +4,8 @@ export interface IQuestConfig extends IBaseConfig { kind: "aki-quest"; redeemTime: number; repeatableQuests: IRepeatableQuestConfig[]; + bearOnlyQuests: string[]; + usecOnlyQuests: string[]; } export interface IRepeatableQuestConfig { name: string; @@ -15,6 +17,10 @@ export interface IRepeatableQuestConfig { locations: Record; traderWhitelist: ITraderWhitelist[]; questConfig: IQuestConfig; + /** Item base types to block when generating rewards */ + rewardBaseTypeBlacklist: string[]; + /** Item tplIds to ignore when generating rewards */ + rewardBlacklist: string[]; } export interface IRewardScaling { levels: number[]; diff --git a/Live/CWX_DeSharpener/server/dist/types/models/spt/config/IRagfairConfig.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/spt/config/IRagfairConfig.d.ts index c24e617..c1b8763 100644 --- a/Live/CWX_DeSharpener/server/dist/types/models/spt/config/IRagfairConfig.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/models/spt/config/IRagfairConfig.d.ts @@ -12,6 +12,7 @@ export interface Sell { chance: Chance; time: Time; reputation: Reputation; + simulatedSellHours: number; } export interface Chance { base: number; @@ -27,11 +28,18 @@ export interface Reputation { gain: number; loss: number; } +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Dynamic { + offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; price: MinMax; presetPrice: MinMax; + showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; condition: Condition; stackablePercent: MinMax; diff --git a/Live/CWX_DeSharpener/server/dist/types/models/spt/config/ITraderConfig.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/spt/config/ITraderConfig.d.ts index c8e8044..6b1c1e3 100644 --- a/Live/CWX_DeSharpener/server/dist/types/models/spt/config/ITraderConfig.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/models/spt/config/ITraderConfig.d.ts @@ -12,8 +12,10 @@ export interface UpdateTime { seconds: number; } export interface FenceConfig { + partialRefreshTimeSeconds: number; + partialRefreshChangePercent: number; assortSize: number; - maxPresetsCount: number; + maxPresetsPercent: number; presetPriceMult: number; blacklist: string[]; } diff --git a/Live/CWX_DeSharpener/server/dist/types/models/spt/location/AirDropLootItem.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/spt/location/AirDropLootItem.d.ts new file mode 100644 index 0000000..da791ff --- /dev/null +++ b/Live/CWX_DeSharpener/server/dist/types/models/spt/location/AirDropLootItem.d.ts @@ -0,0 +1,6 @@ +export declare class AirDropLootItem { + id: string; + tpl: string; + isPreset: boolean; + stackCount: number; +} diff --git a/Live/CWX_DeSharpener/server/dist/types/models/spt/logging/LogBackgroundColor.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/spt/logging/LogBackgroundColor.d.ts index 87e08a9..1dd369b 100644 --- a/Live/CWX_DeSharpener/server/dist/types/models/spt/logging/LogBackgroundColor.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/models/spt/logging/LogBackgroundColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogBackgroundColor { - default = "", - black = "blackBG", - red = "redBG", - green = "greenBG", - yellow = "yellowBG", - blue = "blueBG", - magenta = "magentaBG", - cyan = "cyanBG", - white = "whiteBG" + DEFAULT = "", + BLACK = "blackBG", + RED = "redBG", + GREEN = "greenBG", + YELLOW = "yellowBG", + BLUE = "blueBG", + MAGENTA = "magentaBG", + CYAN = "cyanBG", + WHITE = "whiteBG" } diff --git a/Live/CWX_DeSharpener/server/dist/types/models/spt/logging/LogTextColor.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/spt/logging/LogTextColor.d.ts index 7147ae3..6c7abf3 100644 --- a/Live/CWX_DeSharpener/server/dist/types/models/spt/logging/LogTextColor.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/models/spt/logging/LogTextColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogTextColor { - black = "black", - red = "red", - green = "green", - yellow = "yellow", - blue = "blue", - magenta = "magenta", - cyan = "cyan", - white = "white", - gray = "" + BLACK = "black", + RED = "red", + GREEN = "green", + YELLOW = "yellow", + BLUE = "blue", + MAGENTA = "magenta", + CYAN = "cyan", + WHITE = "white", + GRAY = "" } diff --git a/Live/CWX_DeSharpener/server/dist/types/models/spt/server/ILocaleBase.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/spt/server/ILocaleBase.d.ts index 8887c06..6e20b89 100644 --- a/Live/CWX_DeSharpener/server/dist/types/models/spt/server/ILocaleBase.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/models/spt/server/ILocaleBase.d.ts @@ -13,10 +13,10 @@ export interface ILocaleGlobalBase { season: Record; customization: Record; repeatableQuest: Record; - templates: ILocaleTemplateBase; - locations: ILocaleLocationsBase; - banners: ILocaleBannersBase; - trading: ILocaleTradingBase; + templates: Record; + locations: Record; + banners: Record; + trading: Record; } export interface ILocaleQuest { name: string; @@ -31,23 +31,11 @@ export interface ILocaleQuest { export interface ILocalePreset { Name: string; } -export interface ILocaleTemplateBase { - templates: Record; -} -export interface ILocaleLocationsBase { - locations: Record; -} -export interface ILocaleBannersBase { - locations: Record; -} export interface ILocaleProps { Name: string; ShortName: string; Description: string; } -export interface ILocaleTradingBase { - locations: Record; -} export interface ILocaleTradingProps { FullName: string; FirstName: string; diff --git a/Live/CWX_DeSharpener/server/dist/types/models/spt/services/LootItem.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/spt/services/LootItem.d.ts new file mode 100644 index 0000000..acb7606 --- /dev/null +++ b/Live/CWX_DeSharpener/server/dist/types/models/spt/services/LootItem.d.ts @@ -0,0 +1,6 @@ +export declare class LootItem { + id?: string; + tpl: string; + isPreset: boolean; + stackCount: number; +} diff --git a/Live/CWX_DeSharpener/server/dist/types/models/spt/services/LootRequest.d.ts b/Live/CWX_DeSharpener/server/dist/types/models/spt/services/LootRequest.d.ts new file mode 100644 index 0000000..1da8770 --- /dev/null +++ b/Live/CWX_DeSharpener/server/dist/types/models/spt/services/LootRequest.d.ts @@ -0,0 +1,11 @@ +import { MinMax } from "../../common/MinMax"; +export declare class LootRequest { + presetCount: MinMax; + itemCount: MinMax; + itemBlacklist: string[]; + itemTypeWhitelist: string[]; + /** key: item base type: value: max count */ + itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; +} diff --git a/Live/CWX_DeSharpener/server/dist/types/servers/DatabaseServer.d.ts b/Live/CWX_DeSharpener/server/dist/types/servers/DatabaseServer.d.ts index aa152d0..b3d29e9 100644 --- a/Live/CWX_DeSharpener/server/dist/types/servers/DatabaseServer.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/servers/DatabaseServer.d.ts @@ -2,5 +2,5 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; export declare class DatabaseServer { protected tableData: IDatabaseTables; getTables(): IDatabaseTables; - setTables(any: any): void; + setTables(tableData: IDatabaseTables): void; } diff --git a/Live/CWX_DeSharpener/server/dist/types/servers/RagfairServer.d.ts b/Live/CWX_DeSharpener/server/dist/types/servers/RagfairServer.d.ts index bc86cdb..c93864b 100644 --- a/Live/CWX_DeSharpener/server/dist/types/servers/RagfairServer.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/servers/RagfairServer.d.ts @@ -1,4 +1,6 @@ import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { TraderAssortHelper } from "../helpers/TraderAssortHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -12,11 +14,18 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected traderHelper: TraderHelper; + protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, configServer: ConfigServer); + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); load(): void; update(): void; + /** + * Get traders who need to be periodically refreshed + * @returns string array of traders + */ + protected getUpdateableTraders(): string[]; getAllCategories(): Record; getBespokeCategories(offers: IRagfairOffer[]): Record; /** diff --git a/Live/CWX_DeSharpener/server/dist/types/services/BotEquipmentFilterService.d.ts b/Live/CWX_DeSharpener/server/dist/types/services/BotEquipmentFilterService.d.ts index e49645b..632f961 100644 --- a/Live/CWX_DeSharpener/server/dist/types/services/BotEquipmentFilterService.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/services/BotEquipmentFilterService.d.ts @@ -1,12 +1,12 @@ import { IBotType } from "../models/eft/common/tables/IBotType"; -import { Equipment, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; protected configServer: ConfigServer; protected botConfig: IBotConfig; - protected botEquipmentFilterlists: Record; + protected botEquipmentFilterlists: Record; constructor(logger: ILogger, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig @@ -22,7 +22,7 @@ export declare class BotEquipmentFilterService { * @param playerLevel Level of the player * @returns EquipmentBlacklistDetails object */ - protected getBotEquipmentBlacklist(botRole: string, playerLevel: number): EquipmentFilterDetails; + getBotEquipmentBlacklist(botRole: string, playerLevel: number): EquipmentFilterDetails; /** * Get the whitelist for a specific bot type that's within the players level * @param botRole Bot type diff --git a/Live/CWX_DeSharpener/server/dist/types/services/BotGenerationCacheService.d.ts b/Live/CWX_DeSharpener/server/dist/types/services/BotGenerationCacheService.d.ts new file mode 100644 index 0000000..670c583 --- /dev/null +++ b/Live/CWX_DeSharpener/server/dist/types/services/BotGenerationCacheService.d.ts @@ -0,0 +1,52 @@ +import { BotHelper } from "../helpers/BotHelper"; +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotGenerationCacheService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected botHelper: BotHelper; + protected storedBots: IBotBase[]; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); + /** + * Store array of bots in cache, shuffle results before storage + * @param botsToStore + */ + storeBots(botsToStore: IBotBase[]): void; + /** + * Find and return a bot based on its role + * Remove bot from internal array so it can't be retreived again + * @param role role to retreive (assault/bossTagilla etc) + * @returns IBotBase object + */ + getBot(role: string): IBotBase[]; + /** + * Find a bot by its index from cache + * @param indexOfBotToReturn index to find bot by + * @returns bot profile + */ + protected getBotFromCache(indexOfBotToReturn: number): IBotBase; + /** + * Remove bot profile by index from cache + * @param indexOfBotToReturn Index of bot profile to remove + */ + protected removeBotFromCache(indexOfBotToReturn: number): void; + /** + * Get index of bot profile that matches criteria + * @param role role of bot we want + * @param getPmc is requested bot a pmc + * @returns index of found bot + */ + protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; + /** + * Remove all cached bot profiles + */ + clearStoredBots(): void; + /** + * Does cache have bots + * @returns true if empty + */ + cacheIsEmpty(): boolean; +} diff --git a/Live/CWX_DeSharpener/server/dist/types/services/BotLootCacheService.d.ts b/Live/CWX_DeSharpener/server/dist/types/services/BotLootCacheService.d.ts index cc71eee..00ffb9c 100644 --- a/Live/CWX_DeSharpener/server/dist/types/services/BotLootCacheService.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/services/BotLootCacheService.d.ts @@ -34,6 +34,17 @@ export declare class BotLootCacheService { * @param isPmc Is the bot a PMC (alteres what loot is cached) */ protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; + /** + * Sort a pool of item objects by its flea price + * @param poolToSort pool of items to sort + */ + protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; + /** + * Add unique items into combined pool + * @param combinedItemPool Pool of items to add to + * @param itemsToAdd items to add to combined pool if unique + */ + protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; /** * Ammo/grenades have this property * @param props diff --git a/Live/CWX_DeSharpener/server/dist/types/services/FenceService.d.ts b/Live/CWX_DeSharpener/server/dist/types/services/FenceService.d.ts index 79058c6..23fbf52 100644 --- a/Live/CWX_DeSharpener/server/dist/types/services/FenceService.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/services/FenceService.d.ts @@ -11,29 +11,109 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; +import { ItemFilterService } from "./ItemFilterService"; +/** + * Handle actions surrounding Fence + * e.g. generating or refreshing assorts / get next refresh time + */ export declare class FenceService { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); + protected nextMiniRefreshTimestamp: number; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; - getFenceAssorts(): ITraderAssort; - hasExpiredCache(refreshAssort: boolean): boolean; - generateFenceAssortCache(pmcData: IPmcData): void; /** - * Get the fence level the passed in profile has + * Get assorts player can purchase + * Adjust prices based on fence level of player + * @param pmcProfile Player profile + * @returns ITraderAssort + */ + getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Get fence assorts with no price adjustments based on fence rep + * @returns ITraderAssort + */ + getRawFenceAssorts(): ITraderAssort; + /** + * Does fence need to perform a partial refresh because its passed the refresh timer defined in trader.json + * @returns true if it needs a partial refresh + */ + needsPartialRefresh(): boolean; + /** + * Replace a percentage of fence assorts with freshly generated items + */ + performPartialRefresh(): void; + /** + * Increment fence next refresh timestamp by current timestamp + partialRefreshTimeSeconds from config + */ + protected incrementPartialRefreshTime(): void; + /** + * Compare the current fence offer count to what the config wants it to be, + * If value is lower add extra count to value to generate more items to fill gap + * @param existingItemCountToReplace count of items to generate + * @returns number of items to generate + */ + protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + /** + * Choose an item (not mod) at random and remove from assorts + */ + protected removeRandomItemFromAssorts(): void; + /** + * Get an integer rounded count of items to replace based on percentrage from traderConfig value + * @param totalItemCount total item count + * @returns rounded int of items to replace + */ + protected getCountOfItemsToReplace(totalItemCount: number): number; + /** + * Get the count of items fence offers + * @returns number + */ + getOfferCount(): number; + /** + * Create a trader assort for fence + */ + generateFenceAssortCache(): void; + /** + * Create skeleton to hold assort items + * @returns ITraderAssort object + */ + protected createBaseTraderAssortItem(): ITraderAssort; + /** + * Hydrate result parameter object with generated assorts + * @param assortCount Number of assorts to generate + * @param assorts object to add assorts to + */ + protected createAssorts(assortCount: number, assorts: ITraderAssort): void; + /** + * Get the next update timestamp for fence + * @returns future timestamp + */ + getNextFenceUpdateTimestamp(): number; + /** + * Get fence refresh time in seconds + */ + protected getFenceRefreshTime(): number; + /** + * Get fence level the passed in profile has * @param pmcData Player profile - * @returns FenceLevel + * @returns FenceLevel object */ getFenceInfo(pmcData: IPmcData): FenceLevel; + /** + * Remove an assort from fence by id + * @param assortIdToRemove assort id to remove from fence assorts + */ removeFenceOffer(assortIdToRemove: string): void; - updateFenceOffers(pmcData: IPmcData): void; } diff --git a/Live/CWX_DeSharpener/server/dist/types/services/InsuranceService.d.ts b/Live/CWX_DeSharpener/server/dist/types/services/InsuranceService.d.ts index 171bf10..6be8a2f 100644 --- a/Live/CWX_DeSharpener/server/dist/types/services/InsuranceService.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/services/InsuranceService.d.ts @@ -2,6 +2,7 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { InsuredItem } from "../models/eft/common/tables/IBotBase"; import { Item } from "../models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; @@ -44,8 +45,22 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; + /** + * Store lost gear post-raid inside profile + * @param pmcData player profile to store gear in + * @param offraidData post-raid request object + * @param preRaidGear gear player wore prior to raid + * @param sessionID Session id + */ storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string): void; storeInsuredItemsForReturn(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string): void; - protected addGearToSend(pmcData: IPmcData, insuredItem: any, actualItem: any, sessionID: string): any; + /** + * Add gear item to InsuredItems array in player profile + * @param pmcData profile to store item in + * @param insuredItem Item to store in profile + * @param actualItem item to store + * @param sessionID Session id + */ + protected addGearToSend(pmcData: IPmcData, insuredItem: InsuredItem, actualItem: Item, sessionID: string): void; getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; } diff --git a/Live/CWX_DeSharpener/server/dist/types/services/ItemFilterService.d.ts b/Live/CWX_DeSharpener/server/dist/types/services/ItemFilterService.d.ts new file mode 100644 index 0000000..c9c8ef3 --- /dev/null +++ b/Live/CWX_DeSharpener/server/dist/types/services/ItemFilterService.d.ts @@ -0,0 +1,24 @@ +import { IItemConfig } from "../models/spt/config/IItemConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +/** Centralise the handling of blacklisting items, uses blacklist found in config/item.json */ +export declare class ItemFilterService { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected blacklist: string[]; + protected itemConfig: IItemConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Check if the provided template id is blacklisted in config/item.json + * @param tpl template id + * @returns true if blacklisted + */ + isItemBlacklisted(tpl: string): boolean; + /** + * Return every template id blacklisted in config/item.json + * @returns string array of blacklisted tempalte ids + */ + getBlacklistedItems(): string[]; +} diff --git a/Live/CWX_DeSharpener/server/dist/types/services/PmcAiService.d.ts b/Live/CWX_DeSharpener/server/dist/types/services/PmcAiService.d.ts new file mode 100644 index 0000000..0690f1f --- /dev/null +++ b/Live/CWX_DeSharpener/server/dist/types/services/PmcAiService.d.ts @@ -0,0 +1,27 @@ +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +/** Storing/retreving pmcRoles set at the start of a raid - its done at that point as we know what location the player is heading to */ +export declare class PmcAiService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + protected usecRole: string; + protected bearRole: string; + constructor(logger: ILogger, configServer: ConfigServer); + /** + * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) + * @param pmcSide eft side (usec/bear) + * @returns pmc side as defined in config + */ + getPmcRole(pmcSide: "usec" | "bear" | string): string; + /** + * Set the roles for pmcs + * @param location map location to look up and use as pmc types + */ + setPmcRolesByLocation(location: string): void; + /** + * Clear the saved role from usec/bear PMCs + */ + clearPmcRoles(): void; +} diff --git a/Live/CWX_DeSharpener/server/dist/types/services/ProfileFixerService.d.ts b/Live/CWX_DeSharpener/server/dist/types/services/ProfileFixerService.d.ts index ed1dec7..9cb5a38 100644 --- a/Live/CWX_DeSharpener/server/dist/types/services/ProfileFixerService.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/services/ProfileFixerService.d.ts @@ -45,6 +45,11 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to find and remove slots from */ protected removeResourcesFromSlotsInHideoutWithoutLocationIndexValue(pmcProfile: IPmcData): void; + /** + * Hideout slots need to be in a specific order, locationIndex in ascending order + * @param pmcProfile profile to edit + */ + protected reorderHideoutAreasWithResouceInputs(pmcProfile: IPmcData): void; /** * add in objects equal to the number of slots * @param areaType area to check diff --git a/Live/CWX_DeSharpener/server/dist/types/services/ProfileSnapshotService.d.ts b/Live/CWX_DeSharpener/server/dist/types/services/ProfileSnapshotService.d.ts new file mode 100644 index 0000000..445ffd0 --- /dev/null +++ b/Live/CWX_DeSharpener/server/dist/types/services/ProfileSnapshotService.d.ts @@ -0,0 +1,30 @@ +import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { JsonUtil } from "../utils/JsonUtil"; +export declare class ProfileSnapshotService { + protected jsonUtil: JsonUtil; + protected storedProfileSnapshots: Record; + constructor(jsonUtil: JsonUtil); + /** + * Store a profile into an in-memory object + * @param sessionID session id - acts as the key + * @param profile - profile to save + */ + storeProfileSnapshot(sessionID: string, profile: IAkiProfile): void; + /** + * Retreve a stored profile + * @param sessionID key + * @returns A player profile object + */ + getProfileSnapshot(sessionID: string): IAkiProfile; + /** + * Does a profile exists against the provided key + * @param sessionID key + * @returns true if exists + */ + hasProfileSnapshot(sessionID: string): boolean; + /** + * Remove a stored profile by key + * @param sessionID key + */ + clearProfileSnapshot(sessionID: string): void; +} diff --git a/Live/CWX_DeSharpener/server/dist/types/services/RagfairOfferService.d.ts b/Live/CWX_DeSharpener/server/dist/types/services/RagfairOfferService.d.ts index 7398a8f..f9e3a34 100644 --- a/Live/CWX_DeSharpener/server/dist/types/services/RagfairOfferService.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/services/RagfairOfferService.d.ts @@ -24,7 +24,6 @@ export declare class RagfairOfferService { protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected toUpdate: Record; protected expiredOffers: Item[]; protected offers: IRagfairOffer[]; protected ragfairConfig: IRagfairConfig; @@ -38,8 +37,6 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; - setTraderUpdateStatus(traderId: string, shouldUpdate: boolean): void; - shouldTraderBeUpdated(traderID: string): boolean; getExpiredOfferCount(): number; /** * Get an array of expired items not yet processed into new offers @@ -53,12 +50,15 @@ export declare class RagfairOfferService { * @returns offer exists - true */ doesOfferExist(offerId: string): boolean; - getTraders(): Record; - flagTraderForUpdate(expiredOfferUserId: string): void; removeOfferById(offerId: string): void; removeOfferStack(offerID: string, amount: number): void; removeAllOffersByTrader(traderId: string): void; - addTradersToUpdateList(): void; + /** + * Do the trader offers on flea need to be refreshed + * @param traderID Trader to check + * @returns true if they do + */ + traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; /** diff --git a/Live/CWX_DeSharpener/server/dist/types/services/RagfairPriceService.d.ts b/Live/CWX_DeSharpener/server/dist/types/services/RagfairPriceService.d.ts index 679fe1d..466c9e3 100644 --- a/Live/CWX_DeSharpener/server/dist/types/services/RagfairPriceService.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/services/RagfairPriceService.d.ts @@ -27,6 +27,20 @@ export declare class RagfairPriceService { getDynamicPrice(itemTpl: string): number; getAllFleaPrices(): Record; getFleaPriceForItem(tplId: string): number; + /** + * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * @param itemPrice price of item + * @param itemTpl item template Id being checked + * @returns adjusted price value in roubles + */ + protected adjustPriceIfBelowHandbook(itemPrice: number, itemTpl: string): number; + /** + * Get the percentage difference between two values + * @param a numerical value a + * @param b numerical value b + * @returns different in percent + */ + protected getPriceDifference(a: number, b: number): number; getStaticPriceForItem(tplId: string): number; getBarterPrice(barterScheme: IBarterScheme[]): number; getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; diff --git a/Live/CWX_DeSharpener/server/dist/types/services/RepairService.d.ts b/Live/CWX_DeSharpener/server/dist/types/services/RepairService.d.ts new file mode 100644 index 0000000..3e6077c --- /dev/null +++ b/Live/CWX_DeSharpener/server/dist/types/services/RepairService.d.ts @@ -0,0 +1,75 @@ +import { QuestHelper } from "../helpers/QuestHelper"; +import { RepairHelper } from "../helpers/RepairHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { RepairKitsInfo } from "../models/eft/repair/IRepairActionDataRequest"; +import { RepairItem } from "../models/eft/repair/ITraderRepairActionDataRequest"; +import { IRepairConfig } from "../models/spt/config/IRepairConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ItemEventRouter } from "../routers/ItemEventRouter"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { PaymentService } from "./PaymentService"; +export declare class RepairService { + protected logger: ILogger; + protected itemEventRouter: ItemEventRouter; + protected databaseServer: DatabaseServer; + protected questHelper: QuestHelper; + protected traderHelper: TraderHelper; + protected paymentService: PaymentService; + protected repairHelper: RepairHelper; + protected configServer: ConfigServer; + repairConfig: IRepairConfig; + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + /** + * Use trader to repair an items durability + * @param sessionID Session id + * @param pmcData profile to find item to repair in + * @param repairItemDetails details of the item to repair + * @param traderId Trader being used to repair item + * @returns RepairDetails object + */ + repairItemByTrader(sessionID: string, pmcData: IPmcData, repairItemDetails: RepairItem, traderId: string): RepairDetails; + /** + * + * @param sessionID Session id + * @param pmcData profile to take money from + * @param repairedItemId Repaired item id + * @param repairCost Cost to repair item in roubles + * @param traderId Id of the trader who repaired the item / who is paid + * @param output + */ + payForRepair(sessionID: string, pmcData: IPmcData, repairedItemId: string, repairCost: number, traderId: string, output: IItemEventRouterResponse): void; + /** + * Add skill points to profile after repairing an item + * @param sessionId Session id + * @param repairDetails details of item repaired, cost/item + * @param pmcData Profile to add points to + * @param output IItemEventRouterResponse + */ + addRepairSkillPoints(sessionId: string, repairDetails: RepairDetails, pmcData: IPmcData, output: IItemEventRouterResponse): void; + /** + * + * @param sessionId Session id + * @param pmcData Profile to update repaired item in + * @param repairKits Array of Repair kits to use + * @param itemToRepairId Item id to repair + * @param output IItemEventRouterResponse + * @returns Details of repair, item/price + */ + repairItemByKit(sessionId: string, pmcData: IPmcData, repairKits: RepairKitsInfo[], itemToRepairId: string, output: IItemEventRouterResponse): RepairDetails; + /** + * Update repair kits Resource object if it doesn't exist + * @param repairKitDetails Repair kit details from db + * @param repairKitInInventory Repair kit to update + */ + protected addMaxResourceToKitIfMissing(repairKitDetails: ITemplateItem, repairKitInInventory: Item): void; +} +export declare class RepairDetails { + repairCost?: number; + repairedItem: Item; + repairedItemIsArmor: boolean; +} diff --git a/Live/CWX_DeSharpener/server/dist/types/services/TraderAssortService.d.ts b/Live/CWX_DeSharpener/server/dist/types/services/TraderAssortService.d.ts index 5ba2d05..03b4e12 100644 --- a/Live/CWX_DeSharpener/server/dist/types/services/TraderAssortService.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/services/TraderAssortService.d.ts @@ -2,5 +2,10 @@ import { ITraderAssort } from "../models/eft/common/tables/ITrader"; export declare class TraderAssortService { protected pristineTraderAssorts: Record; getPristineTraderAssort(traderId: string): ITraderAssort; + /** + * Store trader assorts inside a class property + * @param traderId Traderid to store assorts against + * @param assort Assorts to store + */ setPristineTraderAssort(traderId: string, assort: ITraderAssort): void; } diff --git a/Live/CWX_DeSharpener/server/dist/types/utils/HashUtil.d.ts b/Live/CWX_DeSharpener/server/dist/types/utils/HashUtil.d.ts index bacbf2a..a8500e1 100644 --- a/Live/CWX_DeSharpener/server/dist/types/utils/HashUtil.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/utils/HashUtil.d.ts @@ -4,8 +4,18 @@ import { TimeUtil } from "./TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; constructor(timeUtil: TimeUtil); + /** + * Create a 24 character id using the sha256 algorithm + current timestamp + * @returns 24 character hash + */ generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + /** + * Create a hash for the data parameter + * @param algorithm algorithm to use to hash + * @param data data to be hashed + * @returns hash value + */ generateHashForData(algorithm: string, data: crypto.BinaryLike): string; } diff --git a/Live/CWX_DeSharpener/server/dist/types/utils/RandomUtil.d.ts b/Live/CWX_DeSharpener/server/dist/types/utils/RandomUtil.d.ts index c24dd60..633e472 100644 --- a/Live/CWX_DeSharpener/server/dist/types/utils/RandomUtil.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/utils/RandomUtil.d.ts @@ -136,7 +136,7 @@ export declare class RandomUtil { * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with ot without replacement from the input array + * @param {boolean} replacement Draw with or without replacement from the input array * @return {array} Array consisting of N random elements */ drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; @@ -150,4 +150,10 @@ export declare class RandomUtil { */ drawRandomFromDict(dict: any, count?: number, replacement?: boolean): any[]; getBiasedRandomNumber(min: number, max: number, shift: number, n: number): number; + /** + * Fisher-Yates shuffle an array + * @param array Array to shuffle + * @returns Shuffled array + */ + shuffle(array: Array): Array; } diff --git a/Live/CWX_DeSharpener/server/dist/types/utils/TimeUtil.d.ts b/Live/CWX_DeSharpener/server/dist/types/utils/TimeUtil.d.ts index eed4e6d..1367e26 100644 --- a/Live/CWX_DeSharpener/server/dist/types/utils/TimeUtil.d.ts +++ b/Live/CWX_DeSharpener/server/dist/types/utils/TimeUtil.d.ts @@ -1,9 +1,16 @@ +/** + * Utility class to handle time related problems + */ export declare class TimeUtil { static readonly oneHourAsSeconds = 3600; formatTime(date: Date): string; formatDate(date: Date): string; getDate(): string; getTime(): string; + /** + * Get timestamp in seconds + * @returns + */ getTimestamp(): number; /** * mail in eft requires time be in a specific format @@ -15,4 +22,10 @@ export declare class TimeUtil { * @returns current date in format: 00.00.0000 (dd.mm.yyyy) */ getDateMailFormat(): string; + /** + * Convert hours into seconds + * @param hours hours to convert to seconds + * @returns number + */ + getHoursAsSeconds(hours: number): number; } diff --git a/Live/CWX_DeSharpener/server/package.json b/Live/CWX_DeSharpener/server/package.json index 4dd9752..79e57da 100644 --- a/Live/CWX_DeSharpener/server/package.json +++ b/Live/CWX_DeSharpener/server/package.json @@ -1,10 +1,10 @@ { "name": "DeSharpener", "author": "CWX", - "version": "1.4.3", + "version": "1.4.4", "license": "NCSA", "main": "src/mod.js", - "akiVersion": "3.2.2", + "akiVersion": "3.2.3", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" ./**/*.* ./dist", diff --git a/Live/CWX_DeSharpener/server/types/callbacks/InsuranceCallbacks.d.ts b/Live/CWX_DeSharpener/server/types/callbacks/InsuranceCallbacks.d.ts index 6819960..8835ba2 100644 --- a/Live/CWX_DeSharpener/server/types/callbacks/InsuranceCallbacks.d.ts +++ b/Live/CWX_DeSharpener/server/types/callbacks/InsuranceCallbacks.d.ts @@ -1,5 +1,5 @@ import { InsuranceController } from "../controllers/InsuranceController"; -import { OnLoadOnUpdate } from "../di/OnLoadOnUpdate"; +import { OnUpdate } from "../di/OnUpdate"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData"; @@ -10,14 +10,13 @@ import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { InsuranceService } from "../services/InsuranceService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -export declare class InsuranceCallbacks extends OnLoadOnUpdate { +export declare class InsuranceCallbacks extends OnUpdate { protected insuranceController: InsuranceController; protected insuranceService: InsuranceService; protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); - onLoad(): void; getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; diff --git a/Live/CWX_DeSharpener/server/types/callbacks/LocationCallbacks.d.ts b/Live/CWX_DeSharpener/server/types/callbacks/LocationCallbacks.d.ts index cc69369..6e0b538 100644 --- a/Live/CWX_DeSharpener/server/types/callbacks/LocationCallbacks.d.ts +++ b/Live/CWX_DeSharpener/server/types/callbacks/LocationCallbacks.d.ts @@ -11,4 +11,5 @@ export declare class LocationCallbacks { constructor(httpResponse: HttpResponseUtil, locationController: LocationController); getLocationData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocation(url: string, info: IGetLocationRequestData, sessionID: string): IGetBodyResponseData; + getAirdropLoot(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/Live/CWX_DeSharpener/server/types/callbacks/ProfileCallbacks.d.ts b/Live/CWX_DeSharpener/server/types/callbacks/ProfileCallbacks.d.ts index 6a86fc0..183bb0a 100644 --- a/Live/CWX_DeSharpener/server/types/callbacks/ProfileCallbacks.d.ts +++ b/Live/CWX_DeSharpener/server/types/callbacks/ProfileCallbacks.d.ts @@ -1,5 +1,6 @@ import { ProfileController } from "../controllers/ProfileController"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IGetMiniProfileRequestData } from "../models/eft/launcher/IGetMiniProfileRequestData"; @@ -12,20 +13,51 @@ import { ISearchFriendResponse } from "../models/eft/profile/ISearchFriendRespon import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** Handle profile related client events */ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); createProfile(url: string, info: IProfileCreateRequestData, sessionID: string): IGetBodyResponseData; - getProfileData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - regenerateScav(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Get the complete player profile (scav + pmc character) + * @param url + * @param info Empty + * @param sessionID Session id + * @returns Profile object + */ + getProfileData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle the creation of a scav profile for player + * Occurs post-raid and when profile first created immediately after character details are confirmed by player + * @param url + * @param info empty + * @param sessionID Session id + * @returns Profile object + */ + regenerateScav(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/profile/voice/change event + * @param url + * @param info Change voice request object + * @param sessionID Session id + * @returns Client response + */ changeVoice(url: string, info: IProfileChangeVoiceRequestData, sessionID: string): INullResponseData; + /** + * Handle client/game/profile/nickname/change event + * Client allows player to adjust their profile name + * @param url + * @param info Change nickname request object + * @param sessionID Session id + * @returns client response + */ changeNickname(url: string, info: IProfileChangeNicknameRequestData, sessionID: string): IGetBodyResponseData; validateNickname(url: string, info: IValidateNicknameRequestData, sessionID: string): IGetBodyResponseData; getReservedNickname(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** - * Called when creating a character, when you choose a character face/voice + * Called when creating a character when choosing a character face/voice * @param url * @param info response (empty) * @param sessionID diff --git a/Live/CWX_DeSharpener/server/types/callbacks/RagfairCallbacks.d.ts b/Live/CWX_DeSharpener/server/types/callbacks/RagfairCallbacks.d.ts index 3a405c9..c609f2f 100644 --- a/Live/CWX_DeSharpener/server/types/callbacks/RagfairCallbacks.d.ts +++ b/Live/CWX_DeSharpener/server/types/callbacks/RagfairCallbacks.d.ts @@ -19,6 +19,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; +/** + * Handle ragfair related callback events + */ export declare class RagfairCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; protected logger: ILogger; diff --git a/Live/CWX_DeSharpener/server/types/callbacks/RepairCallbacks.d.ts b/Live/CWX_DeSharpener/server/types/callbacks/RepairCallbacks.d.ts index 63733fa..14edeeb 100644 --- a/Live/CWX_DeSharpener/server/types/callbacks/RepairCallbacks.d.ts +++ b/Live/CWX_DeSharpener/server/types/callbacks/RepairCallbacks.d.ts @@ -6,6 +6,20 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa export declare class RepairCallbacks { protected repairController: RepairController; constructor(repairController: RepairController); + /** + * use trader to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + /** + * Use repair kit to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ repair(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/Live/CWX_DeSharpener/server/types/callbacks/TraderCallbacks.d.ts b/Live/CWX_DeSharpener/server/types/callbacks/TraderCallbacks.d.ts index 128d9b2..e4fd099 100644 --- a/Live/CWX_DeSharpener/server/types/callbacks/TraderCallbacks.d.ts +++ b/Live/CWX_DeSharpener/server/types/callbacks/TraderCallbacks.d.ts @@ -9,10 +9,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); onLoad(): void; + onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - onUpdate(): boolean; } diff --git a/Live/CWX_DeSharpener/server/types/context/ContextVariable.d.ts b/Live/CWX_DeSharpener/server/types/context/ContextVariable.d.ts index e438947..0fe0a63 100644 --- a/Live/CWX_DeSharpener/server/types/context/ContextVariable.d.ts +++ b/Live/CWX_DeSharpener/server/types/context/ContextVariable.d.ts @@ -4,7 +4,7 @@ export declare class ContextVariable { private timestamp; private type; constructor(value: any, type: ContextVariableType); - getValue(): any; + getValue(): T; getTimestamp(): Date; getType(): ContextVariableType; } diff --git a/Live/CWX_DeSharpener/server/types/controllers/BotController.d.ts b/Live/CWX_DeSharpener/server/types/controllers/BotController.d.ts index 5e6f05d..a5111d5 100644 --- a/Live/CWX_DeSharpener/server/types/controllers/BotController.d.ts +++ b/Live/CWX_DeSharpener/server/types/controllers/BotController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotHelper } from "../helpers/BotHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; @@ -5,15 +6,22 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { IBotCore } from "../models/eft/common/tables/IBotCore"; import { Difficulty } from "../models/eft/common/tables/IBotType"; import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; +import { PmcAiService } from "../services/PmcAiService"; export declare class BotController { + protected logger: ILogger; protected databaseServer: DatabaseServer; protected botGenerator: BotGenerator; protected botHelper: BotHelper; + protected pmcAiService: PmcAiService; + protected botGenerationCacheService: BotGenerationCacheService; protected configServer: ConfigServer; + protected applicationContext: ApplicationContext; protected botConfig: IBotConfig; - constructor(databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -29,7 +37,18 @@ export declare class BotController { * @returns Difficulty object */ getBotDifficulty(type: string, difficulty: string): Difficulty; - protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string): Difficulty; + protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Generate bot profiles and store in cache + * @param sessionId Session id + * @param info bot generation request info + * @returns IBotBase array + */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the max number of bots allowed on a map + * Looks up location player is entering when getting cap value + * @returns cap number + */ getBotCap(): number; } diff --git a/Live/CWX_DeSharpener/server/types/controllers/GameController.d.ts b/Live/CWX_DeSharpener/server/types/controllers/GameController.d.ts index 85ec418..2d00898 100644 --- a/Live/CWX_DeSharpener/server/types/controllers/GameController.d.ts +++ b/Live/CWX_DeSharpener/server/types/controllers/GameController.d.ts @@ -7,11 +7,13 @@ import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; protected localeService: LocaleService; @@ -20,9 +22,14 @@ export declare class GameController { protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + /** + * Make non-trigger-spawned raiders spawn earlier + always + */ + protected adjustLabsRaiderSpawnRate(): void; protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; + getValidGameVersion(): any; } diff --git a/Live/CWX_DeSharpener/server/types/controllers/HideoutController.d.ts b/Live/CWX_DeSharpener/server/types/controllers/HideoutController.d.ts index 3eefe1a..dcd8894 100644 --- a/Live/CWX_DeSharpener/server/types/controllers/HideoutController.d.ts +++ b/Live/CWX_DeSharpener/server/types/controllers/HideoutController.d.ts @@ -28,6 +28,7 @@ import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,9 +46,10 @@ export declare class HideoutController { protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/Live/CWX_DeSharpener/server/types/controllers/InraidController.d.ts b/Live/CWX_DeSharpener/server/types/controllers/InraidController.d.ts index b899e7d..102a2fb 100644 --- a/Live/CWX_DeSharpener/server/types/controllers/InraidController.d.ts +++ b/Live/CWX_DeSharpener/server/types/controllers/InraidController.d.ts @@ -5,9 +5,11 @@ import { ItemHelper } from "../helpers/ItemHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; @@ -15,6 +17,7 @@ import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class InraidController { + protected logger: ILogger; protected saveServer: SaveServer; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; @@ -29,16 +32,40 @@ export declare class InraidController { protected inRaidHelper: InRaidHelper; protected configServer: ConfigServer; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Handle updating the profile post-pmc raid + * @param sessionID session id + * @param offraidData post-raid data of raid + */ + protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Reduce body part hp to % of max + * @param pmcData profile to edit + * @param multipler multipler to apply to max health + */ + protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + /** + * Handle updating the profile post-pscav raid + * @param sessionID session id + * @param offraidData post-raid data of raid + */ + protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Is the player dead after a raid - dead is anything other than "survived" / "runner" + * @param statusOnExit exit value from offraidData object + * @returns true if dead + */ + protected isPlayerDead(statusOnExit: string): boolean; /** * Mark inventory items as FiR if player survived raid, otherwise remove FiR from them * @param offraidData Save Progress Request * @param pmcData player profile * @param isPlayerScav Was the player a pScav */ - private markOrRemoveFoundInRaidItems; - private handlePostRaidPlayerScavProcess; - private handlePostRaidPlayerScavKarmaChanges; + protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; } diff --git a/Live/CWX_DeSharpener/server/types/controllers/InventoryController.d.ts b/Live/CWX_DeSharpener/server/types/controllers/InventoryController.d.ts index f57f731..f564919 100644 --- a/Live/CWX_DeSharpener/server/types/controllers/InventoryController.d.ts +++ b/Live/CWX_DeSharpener/server/types/controllers/InventoryController.d.ts @@ -92,7 +92,11 @@ export declare class InventoryController { */ toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; /** - * Handles Tagging of items (primary Containers). + * Add a tag to an inventory item + * @param pmcData profile with item to add tag to + * @param body tag request data + * @param sessionID session id + * @returns client response object */ tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/Live/CWX_DeSharpener/server/types/controllers/LocationController.d.ts b/Live/CWX_DeSharpener/server/types/controllers/LocationController.d.ts index 90b6d7a..9db3205 100644 --- a/Live/CWX_DeSharpener/server/types/controllers/LocationController.d.ts +++ b/Live/CWX_DeSharpener/server/types/controllers/LocationController.d.ts @@ -1,18 +1,33 @@ import { LocationGenerator } from "../generators/LocationGenerator"; +import { LootGenerator } from "../generators/LootGenerator"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; +import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; +import { LootItem } from "../models/spt/services/LootItem"; import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class LocationController { protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected logger: ILogger; protected locationGenerator: LocationGenerator; + protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; - constructor(jsonUtil: JsonUtil, logger: ILogger, locationGenerator: LocationGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil); + protected configServer: ConfigServer; + protected airdropConfig: IAirdropConfig; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; generateAll(): ILocationsGenerateAllResponse; + /** + * Get loot for an airdop container + * Generates it randomly based on config/airdrop.json values + * @returns Array of LootItem + */ + getAirdropLoot(): LootItem[]; } diff --git a/Live/CWX_DeSharpener/server/types/controllers/MatchController.d.ts b/Live/CWX_DeSharpener/server/types/controllers/MatchController.d.ts index 71cb7d3..07f6a89 100644 --- a/Live/CWX_DeSharpener/server/types/controllers/MatchController.d.ts +++ b/Live/CWX_DeSharpener/server/types/controllers/MatchController.d.ts @@ -9,23 +9,33 @@ import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestDa import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; +import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { PmcAiService } from "../services/PmcAiService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { + protected logger: ILogger; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected matchLocationService: MatchLocationService; protected traderHelper: TraderHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; + protected profileSnapshotService: ProfileSnapshotService; + protected pmcAiService: PmcAiService; + protected botGenerationCacheService: BotGenerationCacheService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + protected botConfig: IBotConfig; + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/Live/CWX_DeSharpener/server/types/controllers/QuestController.d.ts b/Live/CWX_DeSharpener/server/types/controllers/QuestController.d.ts index 2cbccfb..282f50e 100644 --- a/Live/CWX_DeSharpener/server/types/controllers/QuestController.d.ts +++ b/Live/CWX_DeSharpener/server/types/controllers/QuestController.d.ts @@ -39,16 +39,31 @@ export declare class QuestController { * @returns array of IQuest */ getClientQuests(sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param side player side (usec/bear) + * @param questId questId to check + */ + protected questIsForOtherSide(side: string, questId: string): boolean; + /** + * Handle the client accepting a quest and starting it + * Send starting rewards if any to player and + * Send start notification if any to player + * @param pmcData Profile to update + * @param acceptedQuest Quest accepted + * @param sessionID Session id + * @returns client response + */ acceptQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; acceptRepeatableQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; /** - * Remove completed quest from profile + * Update completed quest in profile * Add newly unlocked quests to profile * Also recalculate thier level due to exp rewards * @param pmcData Player profile - * @param body completed quest request - * @param sessionID session id - * @returns ItemEvent response + * @param body Completed quest request + * @param sessionID Session id + * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -67,10 +82,20 @@ export declare class QuestController { protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the quests provided + * Update quest in profile, otherwise add fresh quest object with failed status * @param sessionID session id * @param pmcData player profile * @param questsToFail quests to fail */ protected failQuests(sessionID: string, pmcData: IPmcData, questsToFail: IQuest[]): void; handoverQuest(pmcData: IPmcData, body: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Increment a backend counter stored value by an amount, + * Create counter if it does not exist + * @param pmcData Profile to find backend counter in + * @param conditionId backend counter id to update + * @param questId quest id counter is associated with + * @param counterValue value to increment the backend counter with + */ + protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; } diff --git a/Live/CWX_DeSharpener/server/types/controllers/RagfairController.d.ts b/Live/CWX_DeSharpener/server/types/controllers/RagfairController.d.ts index c4ffc15..06af740 100644 --- a/Live/CWX_DeSharpener/server/types/controllers/RagfairController.d.ts +++ b/Live/CWX_DeSharpener/server/types/controllers/RagfairController.d.ts @@ -9,6 +9,7 @@ import { RagfairOfferHelper } from "../helpers/RagfairOfferHelper"; import { RagfairSellHelper } from "../helpers/RagfairSellHelper"; import { RagfairSortHelper } from "../helpers/RagfairSortHelper"; import { RagfairTaxHelper } from "../helpers/RagfairTaxHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; @@ -33,6 +34,9 @@ import { RagfairPriceService } from "../services/RagfairPriceService"; import { RagfairRequiredItemsService } from "../services/RagfairRequiredItemsService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** + * Handle RagfairCallback events + */ export declare class RagfairController { protected logger: ILogger; protected timeUtil: TimeUtil; @@ -52,14 +56,20 @@ export declare class RagfairController { protected handbookHelper: HandbookHelper; protected paymentHelper: PaymentHelper; protected inventoryHelper: InventoryHelper; + protected traderHelper: TraderHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected ragfairOfferGenerator: RagfairOfferGenerator; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + /** + * Update a trader flea offer with buy restrictions stored in the traders assort + * @param offer flea offer to update + */ + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer): void; protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; diff --git a/Live/CWX_DeSharpener/server/types/controllers/RepairController.d.ts b/Live/CWX_DeSharpener/server/types/controllers/RepairController.d.ts index 0e78ef6..ae54a53 100644 --- a/Live/CWX_DeSharpener/server/types/controllers/RepairController.d.ts +++ b/Live/CWX_DeSharpener/server/types/controllers/RepairController.d.ts @@ -8,9 +8,9 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa import { IRepairConfig } from "../models/spt/config/IRepairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; -import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { PaymentService } from "../services/PaymentService"; +import { RepairService } from "../services/RepairService"; export declare class RepairController { protected logger: ILogger; protected itemEventRouter: ItemEventRouter; @@ -19,23 +19,23 @@ export declare class RepairController { protected traderHelper: TraderHelper; protected paymentService: PaymentService; protected repairHelper: RepairHelper; - protected configServer: ConfigServer; + protected repairService: RepairService; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); /** * Repair with trader - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + traderRepair(sessionID: string, body: ITraderRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; /** * Repair with repair kit - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - repairWithKit(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + repairWithKit(sessionID: string, body: IRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; } diff --git a/Live/CWX_DeSharpener/server/types/controllers/RepeatableQuestController.d.ts b/Live/CWX_DeSharpener/server/types/controllers/RepeatableQuestController.d.ts index 98d05dd..4c31a3d 100644 --- a/Live/CWX_DeSharpener/server/types/controllers/RepeatableQuestController.d.ts +++ b/Live/CWX_DeSharpener/server/types/controllers/RepeatableQuestController.d.ts @@ -7,6 +7,7 @@ import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; import { TraderInfo } from "../models/eft/common/tables/IBotBase"; import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; import { ELocationName } from "../models/enums/ELocationName"; @@ -15,6 +16,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -64,9 +66,10 @@ export declare class RepeatableQuestController { protected itemEventRouter: ItemEventRouter; protected paymentService: PaymentService; protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. @@ -217,4 +220,16 @@ export declare class RepeatableQuestController { debugLogRepeatableQuestIds(pmcData: IPmcData): void; probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; changeRepeatableQuest(pmcDataIn: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {*} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; } diff --git a/Live/CWX_DeSharpener/server/types/controllers/TraderController.d.ts b/Live/CWX_DeSharpener/server/types/controllers/TraderController.d.ts index 7bab158..b79f55e 100644 --- a/Live/CWX_DeSharpener/server/types/controllers/TraderController.d.ts +++ b/Live/CWX_DeSharpener/server/types/controllers/TraderController.d.ts @@ -4,6 +4,7 @@ import { TraderHelper } from "../helpers/TraderHelper"; import { IBarterScheme, ITraderAssort, ITraderBase } from "../models/eft/common/tables/ITrader"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -15,12 +16,29 @@ export declare class TraderController { protected traderHelper: TraderHelper; protected timeUtil: TimeUtil; protected traderAssortService: TraderAssortService; + protected fenceService: FenceService; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, fenceService: FenceService, jsonUtil: JsonUtil); + /** + * Runs when onLoad event is fired + * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Store timestamp of next assort refresh in nextResupply property of traders .base object + */ load(): void; - getTrader(traderID: string, sessionID: string): ITraderBase; + /** + * Runs when onUpdate is fired + * If current time is > nextResupply(expire) time of trader, refresh traders assorts and + * Fence is handled slightly differently + * @returns has run + */ + update(): boolean; + /** + * Return an array of all traders + * @param sessionID Session id + * @returns array if ITraderBase objects + */ getAllTraders(sessionID: string): ITraderBase[]; - updateTraders(): boolean; + getTrader(sessionID: string, traderID: string): ITraderBase; getAssort(sessionId: string, traderId: string): ITraderAssort; - getPurchasesData(traderID: string, sessionID: string): Record; + getPurchasesData(sessionID: string, traderID: string): Record; } diff --git a/Live/CWX_DeSharpener/server/types/di/Container.d.ts b/Live/CWX_DeSharpener/server/types/di/Container.d.ts index 17791b0..98d1fa1 100644 --- a/Live/CWX_DeSharpener/server/types/di/Container.d.ts +++ b/Live/CWX_DeSharpener/server/types/di/Container.d.ts @@ -1,4 +1,7 @@ import { DependencyContainer } from "tsyringe"; +/** + * Handle the registration of classes to be used by the Dependency Injection code + */ export declare class Container { static registerTypes(depContainer: DependencyContainer): void; static registerListTypes(depContainer: DependencyContainer): void; diff --git a/Live/CWX_DeSharpener/server/types/generators/BotGenerator.d.ts b/Live/CWX_DeSharpener/server/types/generators/BotGenerator.d.ts index a5fc0ad..2ac51db 100644 --- a/Live/CWX_DeSharpener/server/types/generators/BotGenerator.d.ts +++ b/Live/CWX_DeSharpener/server/types/generators/BotGenerator.d.ts @@ -9,6 +9,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { PmcAiService } from "../services/PmcAiService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -30,9 +31,10 @@ export declare class BotGenerator { protected botEquipmentFilterService: BotEquipmentFilterService; protected botHelper: BotHelper; protected gameEventHelper: GameEventHelper; + protected pmcAiService: PmcAiService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, pmcAiService: PmcAiService, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -40,14 +42,14 @@ export declare class BotGenerator { * @param botTemplate base bot template to use (e.g. assault/pmcbot) * @returns */ - generatePlayerScav(role: string, difficulty: string, botTemplate: IBotType): IBotBase; - generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Choose if a bot should become a PMC by checking if bot type is allowed to become a Pmc in botConfig.convertFromChances and doing a random int check - * @param botRole the bot role to check if should be a pmc - * @returns true if should be a pmc + * Generate an array of bot objects for populate a raid with + * @param sessionId session id + * @param info request object + * @returns bot array */ - protected shouldBotBePmc(botRole: string): boolean; + generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** * Get a randomised PMC side based on bot config value 'isUsec' * @returns pmc side as string @@ -58,12 +60,30 @@ export declare class BotGenerator { * @returns IBotBase object */ protected getCloneOfBotBase(): IBotBase; - protected generateBot(bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + /** + * Create a IBotBase object with equipment/loot/exp etc + * @param sessionId Session id + * @param bot bots base file + * @param role botRole bot will use + * @param node Bot template from db/bots/x.json + * @param isPmc Is bot to be a PMC + * @param isPlayerScav is bot to be a p scav bot + * @returns IBotBase object + */ + protected generateBot(sessionId: string, bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; /** * Log the number of PMCs generated to the debug console + * @param output Generated bot array, ready to send to client */ protected logPmcGeneratedCount(output: IBotBase[]): void; - protected generateRandomLevel(min: number, max: number): BotGenerator.IRandomisedBotLevelResult; + /** + * Return a randomised bot level and exp value + * @param role botRole being generated for + * @param min Min exp value + * @param max Max exp value + * @returns IRandomisedBotLevelResult object + */ + protected generateRandomLevel(role: string, min: number, max: number): BotGenerator.IRandomisedBotLevelResult; /** * Converts health object to the required format * @param healthObj health object from bot json @@ -72,19 +92,23 @@ export declare class BotGenerator { */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; protected generateSkills(skillsObj: Skills): Skills; - /** - * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) - * @param pmcSide eft side (usec/bear) - * @returns pmc side as defined in config - */ - protected getPmcRole(pmcSide: string): string; /** * Iterate through bots inventory and loot to find and remove christmas items (as defined in GameEventHelper) * @param nodeInventory Bots inventory to iterate over */ protected removeChristmasItemsFromBotInventory(nodeInventory: Inventory): void; + /** + * Generate a random Id for a bot and apply to bots _id and aid value + * @param bot bot to update + * @returns updated IBotBase object + */ protected generateId(bot: IBotBase): IBotBase; protected generateInventoryID(profile: IBotBase): IBotBase; + /** + * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * @param requestedDifficulty + * @returns + */ protected getPMCDifficulty(requestedDifficulty: string): string; /** * Add a side-specific (usec/bear) dogtag item to a bots inventory diff --git a/Live/CWX_DeSharpener/server/types/generators/BotInventoryGenerator.d.ts b/Live/CWX_DeSharpener/server/types/generators/BotInventoryGenerator.d.ts index 35d1ee8..c5ed545 100644 --- a/Live/CWX_DeSharpener/server/types/generators/BotInventoryGenerator.d.ts +++ b/Live/CWX_DeSharpener/server/types/generators/BotInventoryGenerator.d.ts @@ -1,13 +1,16 @@ +import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Inventory, Chances, Generation, Mods } from "../models/eft/common/tables/IBotType"; +import { Chances, Generation, Inventory, Mods } from "../models/eft/common/tables/IBotType"; +import { EquipmentSlots } from "../models/enums/EquipmentSlots"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; -import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; -import { BotWeaponGenerator } from "./BotWeaponGenerator"; import { BotLootGenerator } from "./BotLootGenerator"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; +import { BotWeaponGenerator } from "./BotWeaponGenerator"; export declare class BotInventoryGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -17,8 +20,14 @@ export declare class BotInventoryGenerator { protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper); - generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { + slot: EquipmentSlots; + shouldSpawn: boolean; + }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; protected generateInventoryBase(): PmcInventory; } diff --git a/Live/CWX_DeSharpener/server/types/generators/BotLootGenerator.d.ts b/Live/CWX_DeSharpener/server/types/generators/BotLootGenerator.d.ts index c6a3f29..c1f5310 100644 --- a/Live/CWX_DeSharpener/server/types/generators/BotLootGenerator.d.ts +++ b/Live/CWX_DeSharpener/server/types/generators/BotLootGenerator.d.ts @@ -1,4 +1,5 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; @@ -20,11 +21,12 @@ export declare class BotLootGenerator { protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botLootCacheService: BotLootCacheService, configServer: ConfigServer); - generateLoot(templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer); + generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached @@ -47,7 +49,7 @@ export declare class BotLootGenerator { * @param botRole bots role, .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; /** * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from diff --git a/Live/CWX_DeSharpener/server/types/generators/BotWeaponGenerator.d.ts b/Live/CWX_DeSharpener/server/types/generators/BotWeaponGenerator.d.ts index 9215214..487901b 100644 --- a/Live/CWX_DeSharpener/server/types/generators/BotWeaponGenerator.d.ts +++ b/Live/CWX_DeSharpener/server/types/generators/BotWeaponGenerator.d.ts @@ -1,4 +1,5 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { MinMax } from "../models/common/MinMax"; @@ -14,6 +15,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { IInventoryMagGen } from "./weapongen/IInventoryMagGen"; export declare class BotWeaponGenerator { protected jsonUtil: JsonUtil; protected logger: ILogger; @@ -24,11 +26,24 @@ export declare class BotWeaponGenerator { protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; protected configServer: ConfigServer; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, inventoryMagGenComponents: IInventoryMagGen[]); /** - * Get a random weapon from a bots pool of weapons (weighted) + * Pick a random weapon based on weightings and generate a functional weapon + * @param equipmentSlot Primary/secondary/holster + * @param botTemplateInventory e.g. assault.json + * @param weaponParentId + * @param modChances + * @param botRole role of bot, e.g. assault/followerBully + * @param isPmc Is weapon generated for a pmc + * @returns GenerateWeaponResult object + */ + generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + /** + * Get a random weighted weapon from a bots pool of weapons * @param equipmentSlot Primary/secondary/holster * @param botTemplateInventory e.g. assault.json * @returns weapon tpl @@ -39,43 +54,24 @@ export declare class BotWeaponGenerator { * @param weaponTpl weapon tpl to generate (use pickWeightedWeaponTplFromPool()) * @param equipmentSlot slot to fit into, primary/secondary/holster * @param botTemplateInventory e.g. assault.json - * @param weaponParentId - * @param modChances - * @param botRole + * @param weaponParentId ParentId of the weapon being generated + * @param modChances Dictionary of item types and % chance weapon will have that mod + * @param botRole e.g. assault/exusec * @param isPmc * @returns GenerateWeaponResult object */ - generateWeaponByTpl(weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; /** - * Generate an entirely random weapon - * @param equipmentSlot Primary/secondary/holster - * @param botTemplateInventory e.g. assault.json - * @param weaponParentId - * @param modChances - * @param botRole - * @param isPmc - * @returns GenerateWeaponResult object - */ - generateRandomWeapon(equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; - /** - * Create array with weapon base as only element - * Add additional properties as required - * @param weaponTpl - * @param weaponParentId - * @param equipmentSlot - * @param weaponItemTemplate + * Create array with weapon base as only element and + * add additional properties based on weapon type + * @param weaponTpl Weapon tpl to create item with + * @param weaponParentId Weapons parent id + * @param equipmentSlot e.g. primary/secondary/holster + * @param weaponItemTemplate db template for weapon * @param botRole for durability values - * @returns + * @returns Base weapon item in array */ - constructWeaponBaseArray(weaponTpl: string, weaponParentId: string, equipmentSlot: string, weaponItemTemplate: ITemplateItem, botRole: string): Item[]; - /** - * Add compatible magazines to an inventory based on a generated weapon - * @param weaponDetails - * @param magCounts - * @param inventory - * @param botRole the bot type we're getting generating extra mags for - */ - addExtraMagazinesToInventory(weaponDetails: GenerateWeaponResult, magCounts: MinMax, inventory: PmcInventory, botRole: string): void; + protected constructWeaponBaseArray(weaponTpl: string, weaponParentId: string, equipmentSlot: string, weaponItemTemplate: ITemplateItem, botRole: string): Item[]; /** * Get the mods necessary to kit out a weapon to its preset level * @param weaponTpl weapon to find preset for @@ -84,33 +80,21 @@ export declare class BotWeaponGenerator { * @returns array of weapon mods */ protected getPresetWeaponMods(weaponTpl: string, equipmentSlot: string, weaponParentId: string, itemTemplate: ITemplateItem, botRole: string): Item[]; - /** Checks if all required slots are occupied on a weapon and all it's mods */ + /** + * Checks if all required slots are occupied on a weapon and all it's mods + * @param weaponItemArray Weapon + mods + * @returns true if valid + */ protected isWeaponValid(weaponItemArray: Item[]): boolean; /** * Generates extra magazines or bullets (if magazine is internal) and adds them to TacticalVest and Pockets. * Additionally, adds extra bullets to SecuredContainer - * @param weaponMods - * @param weaponTemplate - * @param magCounts - * @param ammoTpl - * @param inventory - * @param botRole the bot type we're getting generating extra mags for - * @returns + * @param generatedWeaponResult object with properties for generated weapon (weapon mods pool / weapon template / ammo tpl) + * @param magCounts Magazine count to add to inventory + * @param inventory Inventory to add magazines to + * @param botRole The bot type we're getting generating extra mags for */ - protected generateExtraMagazines(weaponMods: Item[], weaponTemplate: ITemplateItem, magCounts: MinMax, ammoTpl: string, inventory: PmcInventory, botRole: string): void; - /** - * Get a randomised number of bullets for a specific magazine - * @param magCounts min and max count of magazines - * @param magTemplate magazine to generate bullet count for - * @returns bullet count number - */ - protected getRandomisedBulletCount(magCounts: MinMax, magTemplate: ITemplateItem): number; - /** - * Get a randomised count of magazines - * @param magCounts min and max value returned value can be between - * @returns numberical value of magazine count - */ - protected getRandomisedMagazineCount(magCounts: MinMax): number; + addExtraMagazinesToInventory(generatedWeaponResult: GenerateWeaponResult, magCounts: MinMax, inventory: PmcInventory, botRole: string): void; /** * Add ammo to the secure container * @param stackCount How many stacks of ammo to add @@ -127,21 +111,13 @@ export declare class BotWeaponGenerator { * @returns magazine tpl string */ protected getMagazineTplFromWeaponTemplate(weaponMods: Item[], weaponTemplate: ITemplateItem, botRole: string): string; - /** - * Get a weapons default magazine template id - * @param weaponTemplate weapon to get default magazine for - * @returns tpl of magazine - */ - protected getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - protected addBulletsToVestAndPockets(ammoTpl: string, bulletCount: number, inventory: PmcInventory): void; /** * Finds and return a compatible ammo tpl based on the bots ammo weightings (x.json/inventory/equipment/ammo) * @param ammo a list of ammo tpls the weapon can use * @param weaponTemplate the weapon we want to pick ammo for - * @param isPmc is the ammo being gathered for a pmc (runs pmc ammo filtering) * @returns an ammo tpl that works with the desired gun */ - protected getCompatibleAmmo(ammo: Record>, weaponTemplate: ITemplateItem, isPmc: boolean): string; + protected getWeightedCompatibleAmmo(ammo: Record>, weaponTemplate: ITemplateItem): string; /** * Get a weapons compatible cartridge caliber * @param weaponTemplate Weapon to look up caliber of diff --git a/Live/CWX_DeSharpener/server/types/generators/LocationGenerator.d.ts b/Live/CWX_DeSharpener/server/types/generators/LocationGenerator.d.ts index bd368b5..cc61dcf 100644 --- a/Live/CWX_DeSharpener/server/types/generators/LocationGenerator.d.ts +++ b/Live/CWX_DeSharpener/server/types/generators/LocationGenerator.d.ts @@ -3,10 +3,9 @@ import { GameEventHelper } from "../helpers/GameEventHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; -import { ILooseLoot, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; +import { ILooseLoot, SpawnpointsForced, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; import { Item } from "../models/eft/common/tables/IItem"; import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticLootDetails } from "../models/eft/common/tables/ILootBase"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -36,11 +35,19 @@ export declare class LocationGenerator { generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; + /** + * Create array of loose + forced loot using probability system + * @param dynamicLootDist + * @param staticAmmoDist + * @param locationName Location to generate loot for + * @returns Array of spawn points with loot in them + */ generateDynamicLoot(dynamicLootDist: ILooseLoot, staticAmmoDist: Record, locationName: string): SpawnpointTemplate[]; + /** + * Add forced spawn point loot into loot parameter array + * @param loot array to add forced loot to + * @param forcedSpawnPoints forced loot to add + */ + protected addForcedLoot(loot: SpawnpointTemplate[], forcedSpawnPoints: SpawnpointsForced[]): void; protected createItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; - protected getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; - protected getRandomValidCaliber(magTemplate: ITemplateItem): string; - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; - protected createRandomMagCartridges(magTemplate: ITemplateItem, parentId: string, staticAmmoDist: Record, caliber?: string): Item; - protected createCartidges(parentId: string, ammoTpl: string, stackCount: number): Item; } diff --git a/Live/CWX_DeSharpener/server/types/generators/LootGenerator.d.ts b/Live/CWX_DeSharpener/server/types/generators/LootGenerator.d.ts new file mode 100644 index 0000000..bbc1915 --- /dev/null +++ b/Live/CWX_DeSharpener/server/types/generators/LootGenerator.d.ts @@ -0,0 +1,58 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Preset } from "../models/eft/common/IGlobals"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { LootItem } from "../models/spt/services/LootItem"; +import { LootRequest } from "../models/spt/services/LootRequest"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { HashUtil } from "../utils/HashUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class LootGenerator { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected databaseServer: DatabaseServer; + protected randomUtil: RandomUtil; + protected itemHelper: ItemHelper; + protected itemFilterService: ItemFilterService; + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, itemFilterService: ItemFilterService); + /** + * Generate a list of items based on options passed in + * @param options parameters to adjust what loot is generated + * @returns An array of loot items + */ + createRandomloot(options: LootRequest): LootItem[]; + /** + * Construct item limit record to hold max and current item count + * @param limits limits as defined in config + * @returns record, key: item tplId, value: current/max item count allowed + */ + protected initItemLimitCounter(limits: Record): Record; + /** + * Find a random item in items.json and add to result array + * @param items items to choose from + * @param itemTypeCounts item limit counts + * @param options item filters + * @param result array to add found item to + * @returns true if item was valid and added to pool + */ + protected findAndAddRandomItemToLoot(items: [string, ITemplateItem][], itemTypeCounts: Record, options: LootRequest, result: LootItem[]): boolean; + /** + * + * Find a random item in items.json and add to result array + * @param globalDefaultPresets presets to choose from + * @param itemTypeCounts item limit counts + * @param result array to add found preset to + * @returns true if preset was valid and added to pool + */ + protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, Preset][], itemTypeCounts: Record, result: LootItem[]): boolean; +} diff --git a/Live/CWX_DeSharpener/server/types/generators/PMCLootGenerator.d.ts b/Live/CWX_DeSharpener/server/types/generators/PMCLootGenerator.d.ts index 64e6f7f..b9f2a83 100644 --- a/Live/CWX_DeSharpener/server/types/generators/PMCLootGenerator.d.ts +++ b/Live/CWX_DeSharpener/server/types/generators/PMCLootGenerator.d.ts @@ -1,15 +1,21 @@ import { ItemHelper } from "../helpers/ItemHelper"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ConfigServer } from "../servers/ConfigServer"; import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +/** + * Handle the generation of dynamic PMC loot in pockets and backpacks + * and the removal of blacklisted items + */ export declare class PMCLootGenerator { protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; + protected itemFilterService: ItemFilterService; protected pocketLootPool: string[]; protected backpackLootPool: string[]; protected botConfig: IBotConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService); generatePMCPocketLootPool(): string[]; generatePMCBackpackLootPool(): string[]; } diff --git a/Live/CWX_DeSharpener/server/types/generators/RagfairAssortGenerator.d.ts b/Live/CWX_DeSharpener/server/types/generators/RagfairAssortGenerator.d.ts index cbdd7f2..db4811d 100644 --- a/Live/CWX_DeSharpener/server/types/generators/RagfairAssortGenerator.d.ts +++ b/Live/CWX_DeSharpener/server/types/generators/RagfairAssortGenerator.d.ts @@ -1,5 +1,8 @@ import { ItemHelper } from "../helpers/ItemHelper"; +import { Preset } from "../models/eft/common/IGlobals"; import { Item } from "../models/eft/common/tables/IItem"; +import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -8,18 +11,40 @@ export declare class RagfairAssortGenerator { protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; protected generatedAssortItems: Item[]; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer); + protected ragfairConfig: IRagfairConfig; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); /** * Get an array of unique items that can be sold on the flea * @returns array of unique items */ getAssortItems(): Item[]; + /** + * Check internal generatedAssortItems array has objects + * @returns true if array has objects + */ protected assortsAreGenerated(): boolean; /** * Generate an array of items the flea can sell * @returns array of unique items */ protected generateRagfairAssortItems(): Item[]; + /** + * Get presets from globals.json + * @returns Preset object array + */ + protected getPresets(): Preset[]; + /** + * Get default presets from globals.json + * @returns Preset object array + */ + protected getDefaultPresets(): Preset[]; + /** + * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true + * @param tplId tplid to add to item + * @param id id to add to item + * @returns hydrated Item object + */ protected createRagfairAssortItem(tplId: string, id?: string): Item; } diff --git a/Live/CWX_DeSharpener/server/types/generators/RagfairOfferGenerator.d.ts b/Live/CWX_DeSharpener/server/types/generators/RagfairOfferGenerator.d.ts index 3e7f4cc..317cd6b 100644 --- a/Live/CWX_DeSharpener/server/types/generators/RagfairOfferGenerator.d.ts +++ b/Live/CWX_DeSharpener/server/types/generators/RagfairOfferGenerator.d.ts @@ -41,15 +41,37 @@ export declare class RagfairOfferGenerator { createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; protected getTraderId(userID: string): string; protected getRating(userID: string): number; + /** + * Is the offers user rating growing + * @param userID user to check rating of + * @returns true if its growing + */ protected getRatingGrowing(userID: string): boolean; + /** + * Get number of section until offer should expire + * @param userID Id of the offer owner + * @param time Time the offer is posted + * @returns number of seconds until offer expires + */ protected getOfferEndTime(userID: string, time: number): number; /** * Create multiple offers for items by using a unique list of items we've generated previously - * @param expiredOffers + * @param expiredOffers optional, expired offers to regenerate */ generateDynamicOffers(expiredOffers?: Item[]): void; - generateTraderOffers(traderID: string): void; + /** + * Generate trader offers on flea using the traders assort data + * @param traderID Trader to generate offers for + */ + generateFleaOffersForTrader(traderID: string): void; protected getItemCondition(userID: string, items: Item[], itemDetails: ITemplateItem): Item[]; + /** + * Add missing conditions to an item if needed + * Durabiltiy for repairable items + * HpResource for medical items + * @param item item to add conditions to + * @returns Item with conditions added + */ protected addMissingCondition(item: Item): Item; protected getOfferRequirements(items: Item[]): { count: number; @@ -57,6 +79,14 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a flea offer and store it in the Ragfair server offers array + * @param userID owner of the offer + * @param time time offer is put up + * @param items items in the offer + * @param barterScheme + * @param loyalLevel + * @param price price of offer + * @param sellInOnePiece + * @returns */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/Live/CWX_DeSharpener/server/types/generators/ScavCaseRewardGenerator.d.ts b/Live/CWX_DeSharpener/server/types/generators/ScavCaseRewardGenerator.d.ts index c7d6ab7..89cb5c8 100644 --- a/Live/CWX_DeSharpener/server/types/generators/ScavCaseRewardGenerator.d.ts +++ b/Live/CWX_DeSharpener/server/types/generators/ScavCaseRewardGenerator.d.ts @@ -8,9 +8,13 @@ import { RewardCountAndPriceDetails, ScavCaseRewardCountsAndPrices } from "../mo import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { RagfairPriceService } from "../services/RagfairPriceService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +/** + * Handle the creation of randomised scav case rewards + */ export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; @@ -18,9 +22,10 @@ export declare class ScavCaseRewardGenerator { protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param body client request diff --git a/Live/CWX_DeSharpener/server/types/generators/WeatherGenerator.d.ts b/Live/CWX_DeSharpener/server/types/generators/WeatherGenerator.d.ts index 44cecbb..8ddbe49 100644 --- a/Live/CWX_DeSharpener/server/types/generators/WeatherGenerator.d.ts +++ b/Live/CWX_DeSharpener/server/types/generators/WeatherGenerator.d.ts @@ -1,7 +1,7 @@ import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { ConfigServer } from "../servers/ConfigServer"; import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class WeatherGenerator { @@ -21,11 +21,16 @@ export declare class WeatherGenerator { protected getAcceleratedTime(computedDate: Date): string; /** * Get current time formatted to fit BSGs requirement - * @param computedDate + * @param computedDate date to format into bsg style * @returns */ protected getNormalTime(computedDate: Date): string; - generateWeather(data: IWeatherData): IWeatherData; + /** + * Return randomised Weather data + * @param weatherData weather input data + * @returns Randomised weather data + */ + generateWeather(weatherData: IWeatherData): IWeatherData; protected getWeightedFog(): string; protected getWeightedRain(): number; protected getRandomFloat(node: string): number; diff --git a/Live/CWX_DeSharpener/server/types/generators/weapongen/IInventoryMagGen.d.ts b/Live/CWX_DeSharpener/server/types/generators/weapongen/IInventoryMagGen.d.ts new file mode 100644 index 0000000..792f510 --- /dev/null +++ b/Live/CWX_DeSharpener/server/types/generators/weapongen/IInventoryMagGen.d.ts @@ -0,0 +1,6 @@ +import { InventoryMagGen } from "./InventoryMagGen"; +export interface IInventoryMagGen { + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_DeSharpener/server/types/generators/weapongen/InventoryMagGen.d.ts b/Live/CWX_DeSharpener/server/types/generators/weapongen/InventoryMagGen.d.ts new file mode 100644 index 0000000..30bf79f --- /dev/null +++ b/Live/CWX_DeSharpener/server/types/generators/weapongen/InventoryMagGen.d.ts @@ -0,0 +1,16 @@ +import { MinMax } from "../../models/common/MinMax"; +import { Inventory } from "../../models/eft/common/tables/IBotBase"; +import { ITemplateItem } from "../../models/eft/common/tables/ITemplateItem"; +export declare class InventoryMagGen { + private magCounts; + private magazineTemplate; + private weaponTemplate; + private ammoTemplate; + private pmcInventory; + constructor(magCounts: MinMax, magazineTemplate: ITemplateItem, weaponTemplate: ITemplateItem, ammoTemplate: ITemplateItem, pmcInventory: Inventory); + getMagCount(): MinMax; + getMagazineTemplate(): ITemplateItem; + getWeaponTemplate(): ITemplateItem; + getAmmoTemplate(): ITemplateItem; + getPmcInventory(): Inventory; +} diff --git a/Live/CWX_DeSharpener/server/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts b/Live/CWX_DeSharpener/server/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts new file mode 100644 index 0000000..b754d5f --- /dev/null +++ b/Live/CWX_DeSharpener/server/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts @@ -0,0 +1,12 @@ +import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; +import { RandomUtil } from "../../../utils/RandomUtil"; +import { IInventoryMagGen } from "../IInventoryMagGen"; +import { InventoryMagGen } from "../InventoryMagGen"; +export declare class BarrelInventoryMagGen implements IInventoryMagGen { + protected randomUtil: RandomUtil; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + constructor(randomUtil: RandomUtil, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_DeSharpener/server/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/Live/CWX_DeSharpener/server/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts new file mode 100644 index 0000000..4fcb1e2 --- /dev/null +++ b/Live/CWX_DeSharpener/server/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -0,0 +1,14 @@ +import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; +import { ItemHelper } from "../../../helpers/ItemHelper"; +import { ILogger } from "../../../models/spt/utils/ILogger"; +import { IInventoryMagGen } from "../IInventoryMagGen"; +import { InventoryMagGen } from "../InventoryMagGen"; +export declare class ExternalInventoryMagGen implements IInventoryMagGen { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + constructor(logger: ILogger, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_DeSharpener/server/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts b/Live/CWX_DeSharpener/server/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts new file mode 100644 index 0000000..4548a04 --- /dev/null +++ b/Live/CWX_DeSharpener/server/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts @@ -0,0 +1,10 @@ +import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; +import { IInventoryMagGen } from "../IInventoryMagGen"; +import { InventoryMagGen } from "../InventoryMagGen"; +export declare class InternalMagazineInventoryMagGen implements IInventoryMagGen { + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + constructor(botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_DeSharpener/server/types/helpers/AssortHelper.d.ts b/Live/CWX_DeSharpener/server/types/helpers/AssortHelper.d.ts index 15586b9..bfc157f 100644 --- a/Live/CWX_DeSharpener/server/types/helpers/AssortHelper.d.ts +++ b/Live/CWX_DeSharpener/server/types/helpers/AssortHelper.d.ts @@ -17,7 +17,7 @@ export declare class AssortHelper { * @param assort assort items from a trader * @returns assort items minus locked quest assorts */ - stripLockedQuestAssort(pmcProfile: IPmcData, traderId: string, assort: ITraderAssort): ITraderAssort; + stripLockedQuestAssort(pmcProfile: IPmcData, traderId: string, assort: ITraderAssort, flea?: boolean): ITraderAssort; /** * Remove assorts from a trader that have not been unlocked yet * @param pmcProfile player profile @@ -32,5 +32,5 @@ export declare class AssortHelper { * @param itemID item id to remove from asort * @returns Modified assort */ - removeItemFromAssort(assort: ITraderAssort, itemID: string): ITraderAssort; + removeItemFromAssort(assort: ITraderAssort, itemID: string, flea?: boolean): ITraderAssort; } diff --git a/Live/CWX_DeSharpener/server/types/helpers/BotGeneratorHelper.d.ts b/Live/CWX_DeSharpener/server/types/helpers/BotGeneratorHelper.d.ts index 3cd7256..5e3e501 100644 --- a/Live/CWX_DeSharpener/server/types/helpers/BotGeneratorHelper.d.ts +++ b/Live/CWX_DeSharpener/server/types/helpers/BotGeneratorHelper.d.ts @@ -1,19 +1,33 @@ import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper"; -import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem"; -import { Grid, ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { ItemFilterService } from "../services/ItemFilterService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotWeaponGeneratorHelper } from "./BotWeaponGeneratorHelper"; import { ContainerHelper } from "./ContainerHelper"; import { InventoryHelper } from "./InventoryHelper"; import { ItemHelper } from "./ItemHelper"; import { ProbabilityHelper } from "./ProbabilityHelper"; +import { ProfileHelper } from "./ProfileHelper"; +export declare class BotModLimits { + scope: ItemCount; + scopeMax: number; + scopeBaseTypes: string[]; + flashlightLaser: ItemCount; + flashlightLaserMax: number; + flashlgihtLaserBaseTypes: string[]; +} +export declare class ItemCount { + count: number; +} export declare class BotGeneratorHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -25,16 +39,121 @@ export declare class BotGeneratorHelper { protected itemHelper: ItemHelper; protected inventoryHelper: InventoryHelper; protected containerHelper: ContainerHelper; + protected botEquipmentFilterService: BotEquipmentFilterService; + protected itemFilterService: ItemFilterService; + protected profileHelper: ProfileHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, configServer: ConfigServer); - generateModsForItem(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, configServer: ConfigServer); /** - * Is this magazine cylinder related (revolvers and grenade launchers) - * @param magazineParentName the name of the magazines parent - * @returns true if it is cylinder related + * Check mods are compatible and add to array + * @param equipment Equipment item to add mods to + * @param modPool Mod list to choose frm + * @param parentId parentid of item to add mod to + * @param parentTemplate template objet of item to add mods to + * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @returns Item + compatible mods as an array */ - magazineIsCylinderRelated(magazineParentName: string): boolean; + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + /** + * @param sessionId session id + * @param weapon Weapon to add mods to + * @param modPool Pool of compatible mods to attach to weapon + * @param weaponParentId parentId of weapon + * @param parentWeaponTemplate Weapon which mods will be generated on + * @param modSpawnChances Mod spawn chances + * @param ammoTpl Ammo tpl to use when generating magazines/cartridges + * @param botRole Role of bot weapon is generated for + * @returns Weapon + mods array + */ + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; + /** + * + * @param modSlot + * @param isRandomisableSlot + * @param modsParent + * @param botEquipBlacklist + * @param itemModPool + * @param weapon array with only weapon tpl in it, ready for mods to be added + * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) + * @param parentTemplate + * @returns + */ + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + /** + * Find mod tpls of a provided type and add to modPool + * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) + * @param modTemplate db object for modItem we get compatible mods from + * @param modPool Pool of mods we are adding to + */ + protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; + /** + * Check if mod item is on limited list + has surpassed the limit set for it + * @param botRole role the bot has e.g. assault + * @param modTemplate mods template data + * @param modLimits limits set for weapon being generated for this bot + * @returns true if over item limit + */ + protected modHasReachedItemLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits): boolean; + /** + * Initalise mod limits to be used when generating a weapon + * @param botRole "assault", "bossTagilla" or "pmc" + * @returns BotModLimits object + */ + protected initModLimits(botRole: string): BotModLimits; + /** + * Generate a pool of mods for this bots mod type if bot has values inside `randomisedWeaponModSlots` array found in bot.json/equipment[botrole] + * @param allowedMods Mods to be added to mod pool + * @param botEquipBlacklist blacklist of items not allowed to be added to mod pool + * @param modSlot Slot to generate mods for + * @param itemModPool base mod pool to replace values of + */ + protected generateDynamicWeaponModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record): void; + /** + * Find all compatible mods for equipment item and add to modPool + * @param itemDetails item to find mods for + * @param modPool ModPool to add mods to + */ + generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods): void; + /** + * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist + * @param allowedMods base mods to filter + * @param botEquipBlacklist equipment blacklist + * @param modSlot slot mods belong to + * @returns Filtered array of mod tpls + */ + protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; + /** + * Check if the specific item type on the weapon has reached the set limit + * @param modTpl log mod tpl if over type limit + * @param currentCount current number of this item on gun + * @param maxLimit mod limit allowed + * @param botRole role of bot we're checking weapon of + * @returns true if limit reached + */ + protected weaponModLimitReached(modTpl: string, currentCount: { + count: number; + }, maxLimit: number, botRole: string): boolean; + /** + * Log errors if mod is not compatible with slot + * @param modToAdd template of mod to check + * @param itemSlot slot the item will be placed in + * @param modSlot slot the mod will fill + * @param parentTemplate tempalte of the mods parent item + * @returns true if valid + */ + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + /** + * Create a mod item with parameters as properties + * @param modId _id + * @param modTpl _tpl + * @param parentId parentId + * @param modSlot slotId + * @param modTemplate Used to add additional properites in the upd object + * @returns Item object + */ + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem): Item; /** * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance @@ -46,7 +165,7 @@ export declare class BotGeneratorHelper { protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; /** * Get a list of containers that hold ammo - * e.g. mod_magazine + * e.g. mod_magazine / patron_in_weapon_000 * @returns string array */ protected getAmmoContainers(): string[]; @@ -62,11 +181,11 @@ export declare class BotGeneratorHelper { * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" - * - * @param {object} items The items where the CylinderMagazine's camora are appended to - * @param {object} modPool modPool which should include available cartrigdes - * @param {string} parentId The CylinderMagazine's UID - * @param {object} parentTemplate The CylinderMagazine's template + * @param items The items where the CylinderMagazine's camora are appended to + * @param modPool modPool which should include available cartrigdes + * @param parentId The CylinderMagazine's UID + * @param parentTemplate The CylinderMagazine's template + * @returns */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** @@ -75,6 +194,13 @@ export declare class BotGeneratorHelper { * @returns string array of shells fro luitple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + /** + * Adds properties to an item + * e.g. Repairable / HasHinge / Foldable / MaxDurability + * @param itemTemplate + * @param botRole Used by weapons to randomise the durability values + * @returns Item Upd object with extra properties + */ generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { upd?: Upd; }; @@ -92,13 +218,15 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; - protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** - * Sort by spawn chance, highest to lowest, higher is more common - * @param unsortedModArray String array to sort - * @returns Sorted string array + * Get a random mod from an items compatible mods Filter array + * @param modTpl + * @param parentSlot + * @param modSlot + * @param items + * @returns item tpl */ - protected sortModArray(unsortedModArray: string[]): string[]; + protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** * Can an item be added to an item without issue * @param items @@ -107,18 +235,8 @@ export declare class BotGeneratorHelper { * @returns true if possible */ isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; - /** - * Adds an item with all its childern into specified equipmentSlots, wherever it fits. - * @param equipmentSlots - * @param parentId - * @param parentTpl - * @param itemWithChildren - * @param inventory - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: PmcInventory): boolean; - protected itemAllowedInContainer(slot: Grid, itemTpl: string): boolean; } +/** TODO - move into own class */ export declare class ExhaustableArray { private itemPool; private randomUtil; diff --git a/Live/CWX_DeSharpener/server/types/helpers/BotHelper.d.ts b/Live/CWX_DeSharpener/server/types/helpers/BotHelper.d.ts index 9b89481..18738e5 100644 --- a/Live/CWX_DeSharpener/server/types/helpers/BotHelper.d.ts +++ b/Live/CWX_DeSharpener/server/types/helpers/BotHelper.d.ts @@ -13,11 +13,34 @@ export declare class BotHelper { protected configServer: ConfigServer; protected botConfig: IBotConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, configServer: ConfigServer); + /** + * Get difficulty settings for desired bot type, if not found use assault bot types + * @param type bot type to retreive difficulty of + * @param difficulty difficulty to get settings for (easy/normal etc) + * @returns Difficulty object + */ getBotDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Get a template object for the specified botRole from bots.types db + * @param role botRole to get template for + * @returns IBotType object + */ getBotTemplate(role: string): IBotType; + /** + * Get difficulty settings for a PMC + * @param type "usec" / "bear" + * @param difficulty what difficulty to retrieve + * @returns Difficulty object + */ getPmcDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Choose a random difficulty from - easy/normal/hard/impossible + * @returns random difficulty + */ + chooseRandomDifficulty(): string; /** * Randomise the chance the PMC will attack their own side + * Look up value in bot.json/chanceSameSideIsHostilePercent * @param difficultySettings pmc difficulty settings */ randomisePmcHostility(difficultySettings: Difficulty): void; @@ -31,7 +54,7 @@ export declare class BotHelper { */ addBotToFriendlyList(difficultySettings: Difficulty, typeToAdd: string): void; /** - * Add a bot to the ENEMY_BOT_TYPES array + * Add a bot to the ENEMY_BOT_TYPES array, do not add itself if its on the enemy list * @param difficultySettings bot settings to alter * @param typesToAdd bot type to add to enemy list */ @@ -42,4 +65,10 @@ export declare class BotHelper { * @param typesToAdd bot type to add to revenge list */ addBotToRevengeList(difficultySettings: Difficulty, typesToAdd: string[]): void; + /** + * Choose if a bot should become a PMC by checking if bot type is allowed to become a Pmc in botConfig.convertFromChances and doing a random int check + * @param botRole the bot role to check if should be a pmc + * @returns true if should be a pmc + */ + shouldBotBePmc(botRole: string): boolean; } diff --git a/Live/CWX_DeSharpener/server/types/helpers/BotWeaponGeneratorHelper.d.ts b/Live/CWX_DeSharpener/server/types/helpers/BotWeaponGeneratorHelper.d.ts new file mode 100644 index 0000000..7e25f56 --- /dev/null +++ b/Live/CWX_DeSharpener/server/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -0,0 +1,78 @@ +import { MinMax } from "../models/common/MinMax"; +import { Inventory } from "../models/eft/common/tables/IBotBase"; +import { Item } from "../models/eft/common/tables/IItem"; +import { Grid, ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { HashUtil } from "../utils/HashUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { ContainerHelper } from "./ContainerHelper"; +import { InventoryHelper } from "./InventoryHelper"; +import { ItemHelper } from "./ItemHelper"; +export declare class BotWeaponGeneratorHelper { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper); + /** + * Get a randomised number of bullets for a specific magazine + * @param magCounts min and max count of magazines + * @param magTemplate magazine to generate bullet count for + * @returns bullet count number + */ + getRandomisedBulletCount(magCounts: MinMax, magTemplate: ITemplateItem): number; + /** + * Get a randomised count of magazines + * @param magCounts min and max value returned value can be between + * @returns numberical value of magazine count + */ + getRandomisedMagazineCount(magCounts: MinMax): number; + /** + * Is this magazine cylinder related (revolvers and grenade launchers) + * @param magazineParentName the name of the magazines parent + * @returns true if it is cylinder related + */ + magazineIsCylinderRelated(magazineParentName: string): boolean; + /** + * Create a magazine using the parameters given + * @param magazineTpl Tpl of the magazine to create + * @param ammoTpl Ammo to add to magazine + * @param magTemplate template object of magazine + * @returns Item array + */ + createMagazine(magazineTpl: string, ammoTpl: string, magTemplate: ITemplateItem): Item[]; + /** + * Add a specific number of cartrdiges to a bots inventory (vest/pocket) + * @param ammoTpl Ammo tpl to add to vest/pockets + * @param cartridgeCount number of cartridges to add to vest/pockets + * @param inventory bot inventory to add cartridges to + */ + addBulletsToVestAndPockets(ammoTpl: string, cartridgeCount: number, inventory: Inventory): void; + /** + * Get a weapons default magazine template id + * @param weaponTemplate weapon to get default magazine for + * @returns tpl of magazine + */ + getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; + /** + * Adds an item with all its childern into specified equipmentSlots, wherever it fits. + * @param equipmentSlots + * @param parentId + * @param parentTpl + * @param itemWithChildren + * @param inventory + * @returns a `boolean` indicating item was added + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): boolean; + /** + * is the provided item allowed inside a container + * @param slot location item wants to be placed in + * @param itemTpl item being placed + * @returns true if allowed + */ + protected itemAllowedInContainer(slot: Grid, itemTpl: string): boolean; +} diff --git a/Live/CWX_DeSharpener/server/types/helpers/HideoutHelper.d.ts b/Live/CWX_DeSharpener/server/types/helpers/HideoutHelper.d.ts index 36e4009..7495a6a 100644 --- a/Live/CWX_DeSharpener/server/types/helpers/HideoutHelper.d.ts +++ b/Live/CWX_DeSharpener/server/types/helpers/HideoutHelper.d.ts @@ -44,14 +44,72 @@ export declare class HideoutHelper { initProduction(recipeId: string, productionTime: number): Production; isProductionType(productive: Productive): productive is Production; applyPlayerUpgradesBonuses(pmcData: IPmcData, bonus: StageBonus): void; + /** + * TODO: + * After looking at the skills there doesnt seem to be a configuration per skill to boost + * the XP gain PER skill. I THINK you should be able to put the variable "SkillProgress" (just like health has it) + * and be able to tune the skill gain PER skill, but I havent tested it and Im not sure! + * @param pmcData + * @param bonus + */ protected applySkillXPBoost(pmcData: IPmcData, bonus: StageBonus): void; + /** + * Process a players hideout, update areas that use resources + increment production timers + * @param sessionID Session id + */ updatePlayerHideout(sessionID: string): void; + /** + * Update progress timer for water collector + * @param pmcData profile to update + * @param productionId id of water collection production to update + * @param hideoutProperties Hideout properties + */ + protected updateWaterCollectorProductionTimer(pmcData: IPmcData, productionId: string, hideoutProperties: { + btcFarmCGs?: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Update progress timer for scav case + * @param pmcData Profile to update + * @param productionId Id of scav case production to update + */ + protected updateScavCaseProductionTimer(pmcData: IPmcData, productionId: string): void; + /** + * Iterate over hideout areas that use resources (fuel/filters etc) and update associated values + * @param sessionID Session id + * @param pmcData Profile to update areas of + * @param hideoutProperties hideout properties + */ + protected updateAreasWithResources(sessionID: string, pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): HideoutArea; - protected updateWaterFilters(waterFilterArea: HideoutArea, pwProd: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; + /** + * Adjust water filter objects resourceValue or delete when they reach 0 resource + * @param waterFilterArea water filter area to update + * @param production production object + * @param isGeneratorOn is generatory enabled + * @param pmcData Player profile + * @returns Updated HideoutArea object + */ + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): HideoutArea; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; protected getBTCSlots(pmcData: IPmcData): number; protected getManagementSkillsSlots(): number; diff --git a/Live/CWX_DeSharpener/server/types/helpers/InRaidHelper.d.ts b/Live/CWX_DeSharpener/server/types/helpers/InRaidHelper.d.ts index c3cbfbb..962df38 100644 --- a/Live/CWX_DeSharpener/server/types/helpers/InRaidHelper.d.ts +++ b/Live/CWX_DeSharpener/server/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -15,19 +16,8 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); - /** - * Reset the SPT inraid property stored in a profile to 'none' - * @param sessionID Session id - */ - protected removePlayer(sessionID: string): void; - /** - * Some maps have one-time-use keys (e.g. Labs - * Remove the relevant key from an inventory based on the post-raid request data passed in - * @param offraidData post-raid data - * @param sessionID Session id - */ - protected removeMapAccessKey(offraidData: ISaveProgressRequestData, sessionID: string): void; + protected profileFixerService: ProfileFixerService; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); /** * Check an array of items and add an upd object to money items with a stack count of 1 * Single stack money items have no upd object and thus no StackObjectsCount, causing issues @@ -52,6 +42,18 @@ export declare class InRaidHelper { * @returns Reset profile object */ updateProfileBaseStats(profileData: IPmcData, saveProgressRequest: ISaveProgressRequestData, sessionID: string): IPmcData; + /** + * Some maps have one-time-use keys (e.g. Labs + * Remove the relevant key from an inventory based on the post-raid request data passed in + * @param offraidData post-raid data + * @param sessionID Session id + */ + protected removeMapAccessKey(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Set the SPT inraid location Profile property to 'none' + * @param sessionID Session id + */ + protected setPlayerInRaidLocationStatusToNone(sessionID: string): void; /** * Adds SpawnedInSession property to items found in a raid * Removes SpawnedInSession for non-scav players if item was taken into raid with SpawnedInSession = true @@ -93,5 +95,10 @@ export declare class InRaidHelper { * @returns true if item is kept after death */ isItemKeptAfterDeath(slotId: string): boolean; + /** + * Return the equipped items from a players inventory + * @param items Players inventory to search through + * @returns an array of equipped items + */ getPlayerGear(items: Item[]): Item[]; } diff --git a/Live/CWX_DeSharpener/server/types/helpers/InventoryHelper.d.ts b/Live/CWX_DeSharpener/server/types/helpers/InventoryHelper.d.ts index dc7cbca..b8e5c9d 100644 --- a/Live/CWX_DeSharpener/server/types/helpers/InventoryHelper.d.ts +++ b/Live/CWX_DeSharpener/server/types/helpers/InventoryHelper.d.ts @@ -43,6 +43,7 @@ export declare class InventoryHelper { constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; diff --git a/Live/CWX_DeSharpener/server/types/helpers/ItemHelper.d.ts b/Live/CWX_DeSharpener/server/types/helpers/ItemHelper.d.ts index 1701c62..0effaf2 100644 --- a/Live/CWX_DeSharpener/server/types/helpers/ItemHelper.d.ts +++ b/Live/CWX_DeSharpener/server/types/helpers/ItemHelper.d.ts @@ -1,35 +1,30 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { InsuredItem } from "../models/eft/common/tables/IBotBase"; import { Item, Repairable } from "../models/eft/common/tables/IItem"; +import { IStaticAmmoDetails } from "../models/eft/common/tables/ILootBase"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ObjectId } from "../utils/ObjectId"; +import { RandomUtil } from "../utils/RandomUtil"; declare class ItemHelper { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected randomUtil: RandomUtil; + protected objectId: ObjectId; + protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer); /** - * Checks if a id is a valid item. Valid meaning that it's an item that be stored in stash + * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl * @returns boolean; true for items that may be in player posession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {*} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - isValidRewardItem(tpl: string): boolean; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - getRewardableItems(): [string, ITemplateItem][]; /** * Check if the tpl / template Id provided is a descendent of the baseclass * @@ -84,6 +79,11 @@ declare class ItemHelper { * @returns {array} The array of StackSlotItems */ generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; + /** + * Get cloned copy of all item data from items.json + * @returns array of ITemplateItem objects + */ + getItems(): ITemplateItem[]; /** * Gets item data from items.json * @param tpl items template id to look up @@ -196,6 +196,22 @@ declare class ItemHelper { * @returns ItemSize object (width and height) */ getItemSize(items: Item[], rootItemId: string): ItemHelper.ItemSize; + /** + * Get a random cartridge from an items Filter property + * @param item + * @returns + */ + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + createRandomMagCartridges(magTemplate: ITemplateItem, parentId: string, staticAmmoDist: Record, caliber?: string): Item; + protected getRandomValidCaliber(magTemplate: ITemplateItem): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + createCartidges(parentId: string, ammoTpl: string, stackCount: number): Item; + /** + * Get the size of a stack, return 1 if no stack object count property found + * @param item Item to get stack size of + * @returns size of stack + */ + getItemStackSize(item: Item): number; } declare namespace ItemHelper { interface ItemSize { diff --git a/Live/CWX_DeSharpener/server/types/helpers/ProfileHelper.d.ts b/Live/CWX_DeSharpener/server/types/helpers/ProfileHelper.d.ts index 6c150c8..9c6560a 100644 --- a/Live/CWX_DeSharpener/server/types/helpers/ProfileHelper.d.ts +++ b/Live/CWX_DeSharpener/server/types/helpers/ProfileHelper.d.ts @@ -2,24 +2,41 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Stats } from "../models/eft/common/tables/IBotBase"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; +import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { ItemHelper } from "./ItemHelper"; export declare class ProfileHelper { + protected logger: ILogger; protected jsonUtil: JsonUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected profileSnapshotService: ProfileSnapshotService; protected fenceService: FenceService; - constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; getCompleteProfile(sessionID: string): IPmcData[]; + /** + * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen + * Server saves the post-raid changes prior to the xp screen getting the profile, this results in the xp screen using + * the now updated profile values as a base, meaning it shows x2 xp gained + * Instead, clone the post-raid profile (so we dont alter its values), apply the pre-raid xp values to the cloned objects and return + * Delete snapshot of pre-raid profile prior to returning profile data + * @param sessionId Session id + * @param output pmc and scav profiles array + * @param pmcProfile post-raid pmc profile + * @param scavProfile post-raid scav profile + * @returns updated profile array + */ + protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; /** * Add experience to a PMC inside the players profile diff --git a/Live/CWX_DeSharpener/server/types/helpers/QuestHelper.d.ts b/Live/CWX_DeSharpener/server/types/helpers/QuestHelper.d.ts index 0f68cd5..d66d150 100644 --- a/Live/CWX_DeSharpener/server/types/helpers/QuestHelper.d.ts +++ b/Live/CWX_DeSharpener/server/types/helpers/QuestHelper.d.ts @@ -36,13 +36,30 @@ export declare class QuestHelper { protected configServer: ConfigServer; protected questConfig: IQuestConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); - questStatus(pmcData: IPmcData, questID: string): QuestStatus; /** - * returns true is the condition is satisfied + * Get status of a quest by quest id + * @param pmcData Profile to search + * @param questID Quest id to look up + * @returns QuestStauts enum + */ + getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus; + /** + * returns true is the level condition is satisfied + * @param playerLevel Players level + * @param condition Quest condition + * @returns true if player level is greater than or equal to quest */ - evaluateLevel(pmcProfile: IPmcData, cond: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; - rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progress: number): void; + /** + * Increase skill points of a skill on player profile + * @param sessionID Session id + * @param pmcData Player profile + * @param output output object to send back to client + * @param skillName Name of skill to increase skill points of + * @param progressAmount Amount of skill points to add to skill + */ + rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; getQuestLocale(questId: string): any; /** * Debug Routine for showing some information on the diff --git a/Live/CWX_DeSharpener/server/types/helpers/RagfairOfferHelper.d.ts b/Live/CWX_DeSharpener/server/types/helpers/RagfairOfferHelper.d.ts index 8d03bee..e9d72ca 100644 --- a/Live/CWX_DeSharpener/server/types/helpers/RagfairOfferHelper.d.ts +++ b/Live/CWX_DeSharpener/server/types/helpers/RagfairOfferHelper.d.ts @@ -22,12 +22,14 @@ import { ProfileHelper } from "./ProfileHelper"; import { RagfairHelper } from "./RagfairHelper"; import { RagfairServerHelper } from "./RagfairServerHelper"; import { RagfairSortHelper } from "./RagfairSortHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class RagfairOfferHelper { protected logger: ILogger; protected timeUtil: TimeUtil; protected hashUtil: HashUtil; protected itemEventRouter: ItemEventRouter; protected databaseServer: DatabaseServer; + protected traderHelper: TraderHelper; protected saveServer: SaveServer; protected dialogueHelper: DialogueHelper; protected itemHelper: ItemHelper; @@ -43,10 +45,10 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; - processOffers(sessionID: string): boolean; + processOffersOnProfile(sessionID: string): boolean; protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; diff --git a/Live/CWX_DeSharpener/server/types/helpers/RagfairSellHelper.d.ts b/Live/CWX_DeSharpener/server/types/helpers/RagfairSellHelper.d.ts index 6ec004a..91b8a20 100644 --- a/Live/CWX_DeSharpener/server/types/helpers/RagfairSellHelper.d.ts +++ b/Live/CWX_DeSharpener/server/types/helpers/RagfairSellHelper.d.ts @@ -11,6 +11,12 @@ export declare class RagfairSellHelper { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateSellChance(baseChance: number, offerPrice: number, requirementsPriceInRub: number): number; - rollForSale(sellChance: number, count: number): SellResult[]; + calculateSellChance(baseChancePercent: number, offerPriceRub: number, playerListedPriceRub: number): number; + /** + * Determine if the offer being listed will be sold + * @param sellChancePercent chance item will sell + * @param itemSellCount count of items to sell + * @returns Array of purchases of item(s) lsited + */ + rollForSale(sellChancePercent: number, itemSellCount: number): SellResult[]; } diff --git a/Live/CWX_DeSharpener/server/types/helpers/RagfairServerHelper.d.ts b/Live/CWX_DeSharpener/server/types/helpers/RagfairServerHelper.d.ts index e4939d1..a03cdda 100644 --- a/Live/CWX_DeSharpener/server/types/helpers/RagfairServerHelper.d.ts +++ b/Live/CWX_DeSharpener/server/types/helpers/RagfairServerHelper.d.ts @@ -6,6 +6,7 @@ import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -13,6 +14,9 @@ import { RandomUtil } from "../utils/RandomUtil"; import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { ProfileHelper } from "./ProfileHelper"; +/** + * Helper class for common ragfair server actions + */ export declare class RagfairServerHelper { protected randomUtil: RandomUtil; protected hashUtil: HashUtil; @@ -23,11 +27,12 @@ export declare class RagfairServerHelper { protected localeService: LocaleService; protected dialogueHelper: DialogueHelper; protected jsonUtil: JsonUtil; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; protected static goodsReturnedTemplate: string; - constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); + constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Is item valid / on blacklist / quest item * @param itemDetails diff --git a/Live/CWX_DeSharpener/server/types/helpers/RepairHelper.d.ts b/Live/CWX_DeSharpener/server/types/helpers/RepairHelper.d.ts index 9a3ab29..5b09320 100644 --- a/Live/CWX_DeSharpener/server/types/helpers/RepairHelper.d.ts +++ b/Live/CWX_DeSharpener/server/types/helpers/RepairHelper.d.ts @@ -14,8 +14,17 @@ export declare class RepairHelper { protected configServer: ConfigServer; protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); - updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit?: boolean, applyRandomDegradation?: boolean): Item; - protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number): number; - protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, armorMax: number): number; + /** + * + * @param itemToRepair item to update durability details + * @param itemToRepairDetails db details of item to repair + * @param isArmor Is item being repaired a piece of armor + * @param amountToRepair how many unit of durability to repair + * @param useRepairKit Is item being repaired with a repair kit + * @param applyMaxDurabilityDegradation should item have max durability reduced + */ + updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit: boolean, traderQualityMultipler: number, applyMaxDurabilityDegradation?: boolean): void; + protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number, traderQualityMultipler: number): number; + protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, weaponMax: number, traderQualityMultipler: number): number; isWeaponTemplate(tpl: string): boolean; } diff --git a/Live/CWX_DeSharpener/server/types/helpers/TradeHelper.d.ts b/Live/CWX_DeSharpener/server/types/helpers/TradeHelper.d.ts index 975062b..7ab9768 100644 --- a/Live/CWX_DeSharpener/server/types/helpers/TradeHelper.d.ts +++ b/Live/CWX_DeSharpener/server/types/helpers/TradeHelper.d.ts @@ -39,6 +39,12 @@ export declare class TradeHelper { * @returns */ sellItem(pmcData: IPmcData, body: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Increment the assorts buy count by number of items purchased + * Show error on screen if player attepts 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; protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/Live/CWX_DeSharpener/server/types/helpers/TraderAssortHelper.d.ts b/Live/CWX_DeSharpener/server/types/helpers/TraderAssortHelper.d.ts index 91ba6b9..025efd6 100644 --- a/Live/CWX_DeSharpener/server/types/helpers/TraderAssortHelper.d.ts +++ b/Live/CWX_DeSharpener/server/types/helpers/TraderAssortHelper.d.ts @@ -1,7 +1,7 @@ import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator"; import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; import { Item } from "../models/eft/common/tables/IItem"; -import { ITraderAssort } from "../models/eft/common/tables/ITrader"; +import { ITrader, ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -10,13 +10,16 @@ import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; +import { TimeUtil } from "../utils/TimeUtil"; import { AssortHelper } from "./AssortHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class TraderAssortHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; protected mathUtil: MathUtil; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected assortHelper: AssortHelper; @@ -24,18 +27,32 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts + * Filter out assorts not unlocked due to level OR quest completion * @param sessionId session id - * @param traderId trader id - * @returns a traders assorts + * @param traderId traders id + * @returns a traders' assorts */ - getAssort(sessionId: string, traderId: string): ITraderAssort; + getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset a traders assorts and move nextResupply value to future + * Flag trader as needing a flea offer reset to be picked up by flea update() function + * @param trader trader details to alter + */ + resetExpiredTrader(trader: ITrader): void; + /** + * Does the supplied trader need its assorts refreshed + * @param traderID Trader to check + * @returns true they need refreshing + */ + traderAssortsHaveExpired(traderID: string): boolean; /** * Iterate over all assorts barter_scheme values, find barters selling for money and multiply by multipler in config * @param traderAssort Assorts to multiple price of diff --git a/Live/CWX_DeSharpener/server/types/helpers/TraderHelper.d.ts b/Live/CWX_DeSharpener/server/types/helpers/TraderHelper.d.ts index b2e9d38..0dc93e8 100644 --- a/Live/CWX_DeSharpener/server/types/helpers/TraderHelper.d.ts +++ b/Live/CWX_DeSharpener/server/types/helpers/TraderHelper.d.ts @@ -9,6 +9,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { PlayerService } from "../services/PlayerService"; +import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -23,9 +24,10 @@ export declare class TraderHelper { protected handbookHelper: HandbookHelper; protected playerService: PlayerService; protected fenceService: FenceService; + protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -63,7 +65,7 @@ export declare class TraderHelper { * @param item * @returns boolean */ - protected isWeaponAndBelowTraderBuyDurability(traderID: string, item: Item): boolean; + protected isWeaponBelowTraderBuyDurability(traderID: string, item: Item): boolean; /** * Get the price of an item and all of its attached children * Take into account bonuses/adjsutments e.g. discounts @@ -97,6 +99,17 @@ export declare class TraderHelper { * @param sessionID session id */ lvlUp(traderID: string, sessionID: string): void; + /** + * Get the next update timestamp for a trader + * @param traderID Trader to look up update value for + * @returns future timestamp + */ + getNextUpdateTimestamp(traderID: string): number; + /** + * Get the reset time between trader assort refreshes in seconds + * @param traderId Trader to look up + * @returns Time in seconds + */ getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader diff --git a/Live/CWX_DeSharpener/server/types/loaders/PreAkiModLoader.d.ts b/Live/CWX_DeSharpener/server/types/loaders/PreAkiModLoader.d.ts index 6ded3c6..4ab1689 100644 --- a/Live/CWX_DeSharpener/server/types/loaders/PreAkiModLoader.d.ts +++ b/Live/CWX_DeSharpener/server/types/loaders/PreAkiModLoader.d.ts @@ -33,9 +33,20 @@ export declare class PreAkiModLoader implements IModLoader { protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; /** - * - * @param mods Get an array of broken/invalid mods by name - * @returns Mod names array + * Check for duplciate mods loaded, show error if duplicate mod found + * @param modPackageData dictionary of mod package.json data + */ + protected checkForDuplicateMods(modPackageData: Record): void; + /** + * Check for and return duplicate strings inside an array + * @param stringArray Array to check for duplicates + * @returns string array of duplicates, empty if none found + */ + protected getDuplicates(stringArray: string[]): string[]; + /** + * Get an array of mods with errors that prevent them from working with SPT + * @param mods mods to validate + * @returns Mod names as array */ protected getBrokenMods(mods: string[]): string[]; /** @@ -57,7 +68,12 @@ export declare class PreAkiModLoader implements IModLoader { protected addMod(mod: string): Promise; protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record): boolean; protected isModCompatible(mod: IPackageJsonData, loadedMods: Record): boolean; - protected validMod(mod: string): boolean; + /** + * Validate a mod passes a number of checks + * @param modName name of mod in /mods/ to validate + * @returns true if valid + */ + protected validMod(modName: string): boolean; protected getLoadOrderRecursive(mod: string, result: Record, visited: Record): void; protected getLoadOrder(mods: Record): Record; getContainer(): DependencyContainer; diff --git a/Live/CWX_DeSharpener/server/types/models/eft/common/IGlobals.d.ts b/Live/CWX_DeSharpener/server/types/models/eft/common/IGlobals.d.ts index 9d28dbc..81e2023 100644 --- a/Live/CWX_DeSharpener/server/types/models/eft/common/IGlobals.d.ts +++ b/Live/CWX_DeSharpener/server/types/models/eft/common/IGlobals.d.ts @@ -1175,5 +1175,6 @@ export interface Preset { _name: string; _parent: string; _items: Item[]; + /** Default presets have this property */ _encyclopedia?: string; } diff --git a/Live/CWX_DeSharpener/server/types/models/eft/common/ILocationBase.d.ts b/Live/CWX_DeSharpener/server/types/models/eft/common/ILocationBase.d.ts index b1dd448..78ade9a 100644 --- a/Live/CWX_DeSharpener/server/types/models/eft/common/ILocationBase.d.ts +++ b/Live/CWX_DeSharpener/server/types/models/eft/common/ILocationBase.d.ts @@ -137,7 +137,7 @@ export interface BotLocationModifier { VisibleDistance: number; } export interface MinMaxBot { - WildSpawnType: string; + WildSpawnType: WildSpawnType; max: number; min: number; } @@ -195,7 +195,7 @@ export interface Wave { BotPreset: string; BotSide: string; SpawnPoints: string; - WildSpawnType: string; + WildSpawnType: WildSpawnType; isPlayers: boolean; number: number; slots_max: number; @@ -203,3 +203,7 @@ export interface Wave { time_max: number; time_min: number; } +export declare enum WildSpawnType { + ASSAULT = "assault", + MARKSMAN = "marksman" +} diff --git a/Live/CWX_DeSharpener/server/types/models/eft/common/tables/IBotBase.d.ts b/Live/CWX_DeSharpener/server/types/models/eft/common/tables/IBotBase.d.ts index 0ee468e..25cb861 100644 --- a/Live/CWX_DeSharpener/server/types/models/eft/common/tables/IBotBase.d.ts +++ b/Live/CWX_DeSharpener/server/types/models/eft/common/tables/IBotBase.d.ts @@ -28,6 +28,8 @@ export interface IBotBase { CarExtractCounts: CarExtractCounts; SurvivorClass: SurvivorClass; WishList: string[]; + /** SPT specific property used during bot generation in raid */ + sptIsPmc?: boolean; } export interface Info { EntryPoint: string; @@ -66,13 +68,13 @@ export interface IBan { dateTime: number; } export declare enum BanType { - Chat = 0, - RagFair = 1, - Voip = 2, - Trading = 3, - Online = 4, - Friends = 5, - ChangeNickname = 6 + CHAT = 0, + RAGFAIR = 1, + VOIP = 2, + TRADING = 3, + ONLINE = 4, + FRIENDS = 5, + CHANGE_NICKNAME = 6 } export interface Customization { Head: string; @@ -312,11 +314,11 @@ export interface Notes { export interface CarExtractCounts { } export declare enum SurvivorClass { - Unknown = 0, - Neutralizer = 1, - Marauder = 2, - Paramedic = 3, - Survivor = 4 + UNKNOWN = 0, + NEUTRALIZER = 1, + MARAUDER = 2, + PARAMEDIC = 3, + SURVIVOR = 4 } export interface Quest { qid: string; diff --git a/Live/CWX_DeSharpener/server/types/models/eft/common/tables/ITemplateItem.d.ts b/Live/CWX_DeSharpener/server/types/models/eft/common/tables/ITemplateItem.d.ts index 23a1a14..8569e61 100644 --- a/Live/CWX_DeSharpener/server/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/Live/CWX_DeSharpener/server/types/models/eft/common/tables/ITemplateItem.d.ts @@ -34,6 +34,7 @@ export interface Props { LootExperience?: number; ExamineExperience?: number; HideEntrails?: boolean; + InsuranceDisabled?: boolean; RepairCost?: number; RepairSpeed?: number; ExtraSizeLeft?: number; @@ -79,7 +80,7 @@ export interface Props { HasShoulderContact?: boolean; SightingRange?: number; DoubleActionAccuracyPenaltyMult?: number; - ModesCount: any; + ModesCount?: any; DurabilityBurnModificator?: number; HeatFactor?: number; CoolFactor?: number; @@ -155,7 +156,7 @@ export interface Props { RigLayoutName?: string; MaxDurability?: number; armorZone?: string[]; - armorClass: any; + armorClass?: any; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -206,6 +207,7 @@ export interface Props { IsOneoff?: boolean; MustBoltBeOpennedForExternalReload?: boolean; MustBoltBeOpennedForInternalReload?: boolean; + NoFiremodeOnBoltcatch?: boolean; BoltAction?: boolean; HipAccuracyRestorationDelay?: number; HipAccuracyRestorationSpeed?: number; @@ -252,8 +254,8 @@ export interface Props { foodUseTime?: number; foodEffectType?: string; StimulatorBuffs?: string; - effects_health: any; - effects_damage: any; + effects_health?: any; + effects_damage?: any; MaximumNumberOfUsage?: number; knifeHitDelay?: number; knifeHitSlashRate?: number; diff --git a/Live/CWX_DeSharpener/server/types/models/eft/common/tables/ITrader.d.ts b/Live/CWX_DeSharpener/server/types/models/eft/common/tables/ITrader.d.ts index f0fe2b5..37b2d61 100644 --- a/Live/CWX_DeSharpener/server/types/models/eft/common/tables/ITrader.d.ts +++ b/Live/CWX_DeSharpener/server/types/models/eft/common/tables/ITrader.d.ts @@ -7,7 +7,7 @@ export interface ITrader { suits?: ISuit[]; } export interface ITraderBase { - refreshAssort: boolean; + refreshTraderRagfairOffers: boolean; _id: string; avatar: string; balance_dol: number; @@ -58,7 +58,7 @@ export interface Repair { quality: string; } export interface ITraderAssort { - nextResupply?: number; + nextResupply: number; items: Item[]; barter_scheme: Record; loyal_level_items: Record; @@ -67,6 +67,7 @@ export interface IBarterScheme { count: number; _tpl: string; onlyFunctional?: boolean; + sptQuestLocked?: boolean; } export interface ISuit { _id: string; diff --git a/Live/CWX_DeSharpener/server/types/models/eft/health/Effect.d.ts b/Live/CWX_DeSharpener/server/types/models/eft/health/Effect.d.ts index 2f0adac..7eb3ffc 100644 --- a/Live/CWX_DeSharpener/server/types/models/eft/health/Effect.d.ts +++ b/Live/CWX_DeSharpener/server/types/models/eft/health/Effect.d.ts @@ -1,5 +1,5 @@ export declare enum Effect { - Fracture = "Fracture", - LightBleeding = "LightBleeding", - HeavyBleeding = "HeavyBleeding" + FRACTURE = "Fracture", + LIGHT_BLEEDING = "LightBleeding", + HEAVY_BLEEDING = "HeavyBleeding" } diff --git a/Live/CWX_DeSharpener/server/types/models/eft/health/IOffraidHealRequestData.d.ts b/Live/CWX_DeSharpener/server/types/models/eft/health/IOffraidHealRequestData.d.ts index c242300..26b02bd 100644 --- a/Live/CWX_DeSharpener/server/types/models/eft/health/IOffraidHealRequestData.d.ts +++ b/Live/CWX_DeSharpener/server/types/models/eft/health/IOffraidHealRequestData.d.ts @@ -7,12 +7,12 @@ export interface IOffraidHealRequestData extends IBaseInteractionRequestData { time: number; } export declare enum BodyPart { - Head = 0, - Chest = 1, - Stomach = 2, - LeftArm = 3, - RightArm = 4, - LeftLeg = 5, - RightLeg = 6, - Common = 7 + HEAD = "Head", + CHEST = "Chest", + STOMACH = "Stomach", + LEFT_ARM = "LeftArm", + RIGHT_ARM = "RightArm", + LEFT_LEG = "LeftLeg", + RIGHT_LEG = "RightLeg", + COMMON = "Common" } diff --git a/Live/CWX_DeSharpener/server/types/models/eft/notifier/INotifier.d.ts b/Live/CWX_DeSharpener/server/types/models/eft/notifier/INotifier.d.ts index 8c48260..b248636 100644 --- a/Live/CWX_DeSharpener/server/types/models/eft/notifier/INotifier.d.ts +++ b/Live/CWX_DeSharpener/server/types/models/eft/notifier/INotifier.d.ts @@ -1,9 +1,9 @@ export interface INotifierChannel { - "server": string; - "channel_id": string; - "url": string; - "notifierServer": string; - "ws": string; + server: string; + channel_id: string; + url: string; + notifierServer: string; + ws: string; } import { Message } from "../profile/IAkiProfile"; export interface INotification { diff --git a/Live/CWX_DeSharpener/server/types/models/eft/ragfair/IRagfairOffer.d.ts b/Live/CWX_DeSharpener/server/types/models/eft/ragfair/IRagfairOffer.d.ts index 63f655e..141b605 100644 --- a/Live/CWX_DeSharpener/server/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/Live/CWX_DeSharpener/server/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -15,6 +15,8 @@ export interface IRagfairOffer { name?: string; shortName?: string; loyaltyLevel: number; + buyRestrictionMax?: number; + buyRestrictionCurrent?: number; locked: boolean; unlimitedCount: boolean; summaryCost: number; diff --git a/Live/CWX_DeSharpener/server/types/models/enums/AmmoTypes.d.ts b/Live/CWX_DeSharpener/server/types/models/enums/AmmoTypes.d.ts index b52ddcf..254b410 100644 --- a/Live/CWX_DeSharpener/server/types/models/enums/AmmoTypes.d.ts +++ b/Live/CWX_DeSharpener/server/types/models/enums/AmmoTypes.d.ts @@ -23,7 +23,7 @@ export declare enum Ammo762x54 { BT_GZH = "5e023d34e8a400319a28ed44", BS_GZH = "5e023d48186a883be655e551" } -export declare enum Ammo338Lapua { +export declare enum Ammo86x70 { TAC_X = "5fc382b6d6fa9c00c571bbc3", UCW = "5fc382c1016cce60e8341b20", AP = "5fc382a9d724d907e2077dab", @@ -85,13 +85,13 @@ export declare enum Ammo9x21 { PE_GZH = "5a26ac06c4a282000c5a90a8", BT_GZH = "5a26ac0ec4a28200741e1e18" } -export declare enum Ammo357Mag { +export declare enum Ammo9x33R { FMJ = "62330b3ed4dc74626d570b95", HOLLOW_POINT = "62330bfadc5883093563729b", SOFT_POINT = "62330c40bdd19b369e1e53d1", JACKET_HP = "62330c18744e5e31df12f516" } -export declare enum Ammo45ACP { +export declare enum Ammo1143x23ACP { MATCH_FMJ = "5e81f423763d9f754677bf2e", HYDRA_SHOK = "5efb0fc6aeb21837e749c801", LASERMATCH_FMJ = "5efb0d4f4bc50b58e81710f3", @@ -126,7 +126,7 @@ export declare enum Ammo556x45 { MK_318_MOD_0_SOST = "60194943740c5d77f6705eea", SSA_AP = "601949593ae8f707c4608daa" } -export declare enum Ammo300Blackout { +export declare enum Ammo762x35 { M62_TRACER = "619636be6db0f2477964e710", BCP_FMJ = "5fbe3ffdf8b6a877a729ea82", AP = "5fd20ff893a8961fc660a954", diff --git a/Live/CWX_DeSharpener/server/types/models/enums/BaseClasses.d.ts b/Live/CWX_DeSharpener/server/types/models/enums/BaseClasses.d.ts index e733bca..36ebc71 100644 --- a/Live/CWX_DeSharpener/server/types/models/enums/BaseClasses.d.ts +++ b/Live/CWX_DeSharpener/server/types/models/enums/BaseClasses.d.ts @@ -25,6 +25,7 @@ export declare enum BaseClasses { SIGHTS = "5448fe7a4bdc2d6f028b456b", MEDS = "543be5664bdc2dd4348b4569", MONEY = "543be5dd4bdc2deb348b4569", + NIGHTVISION = "5a2c3a9486f774688b05e574", KEY = "543be5e94bdc2df1348b4568", KEY_MECHANICAL = "5c99f98d86f7745c314214b3", KEYCARD = "5c164d2286f774194c5e69fa", @@ -66,8 +67,8 @@ export declare enum BaseClasses { LUBRICANT = "57864e4c24597754843f8723", BATTERY = "57864ee62459775490116fc1", ASSAULT_SCOPE = "55818add4bdc2d5b648b456f", - REFLEX_SIGHT = "55818ad54bdc2ddc698b4569", TACTICAL_COMBO = "55818b164bdc2ddc698b456c", + FLASHLIGHT = "55818b084bdc2d5b648b4571", MAGAZINE = "5448bc234bdc2d3c308b4569", LIGHT_LASER = "55818b0e4bdc2dde698b456e", FLASH_HIDER = "550aa4bf4bdc2dd6348b456b", diff --git a/Live/CWX_DeSharpener/server/types/models/enums/BotAmount.d.ts b/Live/CWX_DeSharpener/server/types/models/enums/BotAmount.d.ts index d0e1df1..9ef9cab 100644 --- a/Live/CWX_DeSharpener/server/types/models/enums/BotAmount.d.ts +++ b/Live/CWX_DeSharpener/server/types/models/enums/BotAmount.d.ts @@ -1,7 +1,7 @@ export declare enum BotAmount { - AsOnline = "AsOnline", - Low = "Low", - Medium = "Medium", - High = "High", - Horde = "Horde" + AS_ONLINE = "AsOnline", + LOW = "Low", + MEDIUM = "Medium", + HIGH = "High", + HORDE = "Horde" } diff --git a/Live/CWX_DeSharpener/server/types/models/enums/BotDifficulty.d.ts b/Live/CWX_DeSharpener/server/types/models/enums/BotDifficulty.d.ts index c901bcf..80e45ad 100644 --- a/Live/CWX_DeSharpener/server/types/models/enums/BotDifficulty.d.ts +++ b/Live/CWX_DeSharpener/server/types/models/enums/BotDifficulty.d.ts @@ -1,8 +1,8 @@ export declare enum BotDifficulty { - AsOnline = "AsOnline", - Easy = "Easy", - Medium = "Medium", - Hard = "Hard", - Impossible = "Impossible", - Random = "Random" + AS_ONLINE = "AsOnline", + EASY = "Easy", + MEDIUM = "Medium", + HARD = "Hard", + IMPOSSIBLE = "Impossible", + RANDOM = "Random" } diff --git a/Live/CWX_DeSharpener/server/types/models/enums/ConfigTypes.d.ts b/Live/CWX_DeSharpener/server/types/models/enums/ConfigTypes.d.ts index 61d6f99..468ece5 100644 --- a/Live/CWX_DeSharpener/server/types/models/enums/ConfigTypes.d.ts +++ b/Live/CWX_DeSharpener/server/types/models/enums/ConfigTypes.d.ts @@ -8,6 +8,7 @@ export declare enum ConfigTypes { IN_RAID = "aki-inraid", INSURANCE = "aki-insurance", INVENTORY = "aki-inventory", + ITEM = "aki-item", LOCALE = "aki-locale", LOCATION = "aki-location", MATCH = "aki-match", diff --git a/Live/CWX_DeSharpener/server/types/models/enums/ELocationName.d.ts b/Live/CWX_DeSharpener/server/types/models/enums/ELocationName.d.ts index b56cc08..7ae7caa 100644 --- a/Live/CWX_DeSharpener/server/types/models/enums/ELocationName.d.ts +++ b/Live/CWX_DeSharpener/server/types/models/enums/ELocationName.d.ts @@ -1,5 +1,6 @@ export declare enum ELocationName { FACTORY_DAY = "factory4_day", + FACTORY_NIGHT = "factory4_night", BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", diff --git a/Live/CWX_DeSharpener/server/types/models/enums/MemberCategory.d.ts b/Live/CWX_DeSharpener/server/types/models/enums/MemberCategory.d.ts index 3bd9a21..a81380e 100644 --- a/Live/CWX_DeSharpener/server/types/models/enums/MemberCategory.d.ts +++ b/Live/CWX_DeSharpener/server/types/models/enums/MemberCategory.d.ts @@ -1,13 +1,13 @@ export declare enum MemberCategory { - Default = 0, - Developer = 1, - UniqueId = 2, - Trader = 4, - Group = 8, - System = 16, - ChatModerator = 32, - ChatModeratorWithPermanentBan = 64, - UnitTest = 128, - Sherpa = 256, - Emissary = 512 + DEFAULT = 0, + DEVELOPER = 1, + UNIQUE_ID = 2, + TRADER = 4, + GROUP = 8, + SYSTEM = 16, + CHAT_MODERATOR = 32, + CHAT_MODERATOR_WITH_PERMANENT_BAN = 64, + UNIT_TEST = 128, + SHERPA = 256, + EMISSARY = 512 } diff --git a/Live/CWX_DeSharpener/server/types/models/enums/QuestRewardType.d.ts b/Live/CWX_DeSharpener/server/types/models/enums/QuestRewardType.d.ts index 1d3db86..16f7e39 100644 --- a/Live/CWX_DeSharpener/server/types/models/enums/QuestRewardType.d.ts +++ b/Live/CWX_DeSharpener/server/types/models/enums/QuestRewardType.d.ts @@ -1,8 +1,8 @@ export declare enum QuestRewardType { - Skill = "Skill", - Experience = "Experience", - TraderStanding = "TraderStanding", - TraderUnlock = "TraderUnlock", - Item = "Item", - AssortmentUnlock = "AssortmentUnlock" + SKILL = "Skill", + EXPERIENCE = "Experience", + TRADER_STANDING = "TraderStanding", + TRADER_UNLOCK = "TraderUnlock", + ITEM = "Item", + ASSORTMENT_UNLOCK = "AssortmentUnlock" } diff --git a/Live/CWX_DeSharpener/server/types/models/enums/RaidMode.d.ts b/Live/CWX_DeSharpener/server/types/models/enums/RaidMode.d.ts index c5a8cff..e20cf3f 100644 --- a/Live/CWX_DeSharpener/server/types/models/enums/RaidMode.d.ts +++ b/Live/CWX_DeSharpener/server/types/models/enums/RaidMode.d.ts @@ -1,5 +1,5 @@ export declare enum RaidMode { - Online = "Online", - Local = "Local", - Coop = "Coop" + ONLINE = "Online", + LOCAL = "Local", + COOP = "Coop" } diff --git a/Live/CWX_DeSharpener/server/types/models/enums/WeaponTypes.d.ts b/Live/CWX_DeSharpener/server/types/models/enums/WeaponTypes.d.ts new file mode 100644 index 0000000..867b052 --- /dev/null +++ b/Live/CWX_DeSharpener/server/types/models/enums/WeaponTypes.d.ts @@ -0,0 +1,151 @@ +export declare enum Weapons127x55 { + ASH_12 = "5cadfbf7ae92152ac412eeef" +} +export declare enum Weapons86x70 { + MK_18 = "5fc22d7c187fea44d52eda44", + AXMC = "627e14b21713922ded6f2c15" +} +export declare enum Weapons9x39 { + AS_VAL = "57c44b372459772d2b39b8ce", + VSS_VINTOREZ = "57838ad32459774a17445cd2" +} +export declare enum Weapons762x54R { + SVDS = "5c46fbd72e2216398b5a8c9c", + MP_18 = "61f7c9e189e6fb1a5e3ea78d", + MOSIN_INFANTRY = "5bfd297f0db834001a669119", + MOSIN_SNIPER = "5ae08f0a5acfc408fb1398a1", + SV_98 = "55801eed4bdc2d89578b4588" +} +export declare enum Weapons762x51 { + VPO_101 = "5c501a4d2e221602b412b540", + DT_MDR_762 = "5dcbd56fdbd3d91b3e5468d5", + SA_58 = "5b0bbe4e5acfc40dc528a72d", + SCARH_BLACK = "6183afd850224f204c1da514", + SCARH_FDE = "6165ac306ef05c2ce828ef74", + HK_G28 = "6176aca650224f204c1da3fb", + M1A = "5aafa857e5b5b00018480968", + RFB = "5f2a9575926fd9352339381f", + RSASS = "5a367e5dc4a282000e49738f", + SR_25 = "5df8ce05b11454561e39243b", + DVL_10 = "588892092459774ac91d4b11", + M700 = "5bfea6e90db834001b7347f3", + T5000M = "5df24cf80dee1b22f862e9bc" +} +export declare enum Weapons366TKM { + VPO_209 = "59e6687d86f77411d949b251", + VPO_215 = "5de652c31b7e3716273428be" +} +export declare enum Weapons762x39 { + OP_SKS = "587e02ff24597743df3deaeb", + SKS = "574d967124597745970e7c94", + AK_103 = "5ac66d2e5acfc43b321d4b53", + AK_104 = "5ac66d725acfc43b321d4b60", + AKM = "59d6088586f774275f37482f", + AKMN = "5a0ec13bfcdbcb00165aa685", + AKMS = "59ff346386f77477562ff5e2", + AKMSN = "5abcbc27d8ce8700182eceeb", + MK47_MUTANT = "606587252535c57a13424cfd", + RD_704 = "628a60ae6b1d481ff772e9c8", + VPO_136 = "59e6152586f77473dc057aa1" +} +export declare enum Weapons762x35 { + MCX = "5fbcc1d9016cce60e8341ab3" +} +export declare enum Weapons556x45 { + ADAR_2_15 = "5c07c60e0db834002330051f", + AK_101 = "5ac66cb05acfc40198510a10", + AK_102 = "5ac66d015acfc400180ae6e4", + DT_MDR_556 = "5c488a752e221602b412af63", + HK_416A5 = "5bb2475ed4351e00853264e3", + HK_G36 = "623063e994fc3f7b302a9696", + M4A1 = "5447a9cd4bdc2dbd208b4567", + SCARL_BLACK = "6184055050224f204c1da540", + SCARL_FDE = "618428466ef05c2ce828f218", + TX15_DML = "5d43021ca4b9362eab4b5e25" +} +export declare enum Weapons545x39 { + AK_105 = "5ac66d9b5acfc4001633997a", + AK_74 = "5bf3e03b0db834001d2c4a9c", + AK_74M = "5ac4cd105acfc40016339859", + AK_74N = "5644bd2b4bdc2d3b4c8b4572", + AKS_74 = "5bf3e0490db83400196199af", + AKS_74N = "5ab8e9fcd8ce870019439434", + AKS_74U = "57dc2fa62459775949412633", + AKS_74UB = "5839a40f24597726f856b511", + AKS_74UN = "583990e32459771419544dd2", + SAG_AK = "628b5638ad252a16da6dd245", + SAG_AK_SHORT = "628b9c37a733087d0d7fe84b", + RPK_16 = "5beed0f50db834001c062b12" +} +export declare enum Weapons57x28FN { + FN_57_BLACK = "5d3eb3b0a4b93615055e84d2", + FN_57_FDE = "5d67abc1a4b93614ec50137f", + FN_P90 = "5cc82d76e24e8d00134b4b83" +} +export declare enum Weapons46x30HK { + MP7A1 = "5ba26383d4351e00334c93d9", + MP7A2 = "5bd70322209c4d00d7167b8f" +} +export declare enum Weapons1143x23 { + M1911A1 = "5e81c3cbac2bb513793cdc75", + M45A1 = "5f36a0e5fbf956000b716b65", + USP45 = "6193a720f8ee7e52e42109ed", + UMP45 = "5fc3e272f8b6a877a729eac5", + VECTOR45 = "5fb64bc92b1b027b1f50bcf2" +} +export declare enum Weapons9x33R { + CR_50DS = "61a4c8884f95bc3b2c5dc96f" +} +export declare enum Weapons9x21 { + SR_1MP = "59f98b4986f7746f546d2cef" +} +export declare enum Weapons9x19 { + GLOCK_17 = "5a7ae0c351dfba0017554310", + GLOCK_18C = "5b1fa9b25acfc40018633c01", + M9A3 = "5cadc190ae921500103bb3b6", + MP_443 = "576a581d2459771e7b1bc4f1", + P226R = "56d59856d2720bd8418b456a", + PL_15 = "602a9740da11d6478d5a06dc", + CR_200DS = "624c2e8614da335f1e034d8c", + MP5 = "5926bb2186f7744b1c6c6e60", + MP5K = "5d2f0d8048f0356c925bc3b0", + MP9 = "5e00903ae9dc277128008b87", + MP9_N = "5de7bd7bfd6b4e6e2276dc25", + MPX = "58948c8e86f77409493f7266", + PP_19_01 = "59984ab886f7743e98271174", + SAIGA_9 = "59f9cabd86f7743a10721f46", + STM_9 = "60339954d62c9b14ed777c06", + VECTOR_9MM = "5fc3f2d5900b1d5091531e57" +} +export declare enum Weapons9x18 { + APB = "5abccb7dd8ce87001773e277", + APS = "5a17f98cfcdbcb0980087290", + PB_SILENCED = "56e0598dd2720bb5668b45a6", + PM = "5448bd6b4bdc2dfc2f8b4569", + PM_T = "579204f224597773d619e051", + PP9_KLIN = "57f4c844245977379d5c14d1", + PP91_KEDR = "57d14d2524597714373db789", + PP91_KEDRB = "57f3c6bd24597738e730fa2f" +} +export declare enum Weapons762x25 { + TT = "571a12c42459771f627b58a0", + TT_GOLD = "5b3b713c5acfc4330140bd8d", + PPSH_41 = "5ea03f7400685063ec28bfa8" +} +export declare enum Weapons12Gauge { + M3_SUPER90 = "6259b864ebedf17603599e88", + M590A1 = "5e870397991fd70db46995c8", + M870 = "5a7828548dc32e5a9c28b516", + MP_133 = "54491c4f4bdc2db1078b4568", + MP_153 = "56dee2bdd2720bc8328b4567", + MP_155 = "606dae0ab0e443224b421bb7", + MP_43_1C = "5580223e4bdc2d1c128b457f", + MTS_255_12 = "60db29ce99594040e04c4a27", + SAIGA_12GA = "576165642459773c7a400233" +} +export declare enum Weapons20Gauge { + TOZ_106 = "5a38e6bac4a2826c6e06d79b" +} +export declare enum Weapons23x75 { + KS_23M = "5e848cc2988a8701445df1e8" +} diff --git a/Live/CWX_DeSharpener/server/types/models/spt/bots/BotLootCache.d.ts b/Live/CWX_DeSharpener/server/types/models/spt/bots/BotLootCache.d.ts index e185315..aedf7b0 100644 --- a/Live/CWX_DeSharpener/server/types/models/spt/bots/BotLootCache.d.ts +++ b/Live/CWX_DeSharpener/server/types/models/spt/bots/BotLootCache.d.ts @@ -11,13 +11,13 @@ export declare class BotLootCache { grenadeItems: ITemplateItem[]; } export declare enum LootCacheType { - Special = "Special", - Backpack = "Backpack", - Pocket = "Pocket", - Vest = "Vest", - Combined = "Combined", - HealingItems = "HealingItems", - DrugItems = "DrugItems", - StimItems = "StimItems", - GrenadeItems = "GrenadeItems" + SPECIAL = "Special", + BACKPACK = "Backpack", + POCKET = "Pocket", + VEST = "Vest", + COMBINED = "Combined", + HEALING_ITEMS = "HealingItems", + DRUG_ITEMS = "DrugItems", + STIM_ITEMS = "StimItems", + GRENADE_ITEMS = "GrenadeItems" } diff --git a/Live/CWX_DeSharpener/server/types/models/spt/config/IAirdropConfig.d.ts b/Live/CWX_DeSharpener/server/types/models/spt/config/IAirdropConfig.d.ts index f4aee89..3edcbdd 100644 --- a/Live/CWX_DeSharpener/server/types/models/spt/config/IAirdropConfig.d.ts +++ b/Live/CWX_DeSharpener/server/types/models/spt/config/IAirdropConfig.d.ts @@ -1,14 +1,14 @@ +import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IAirdropConfig extends IBaseConfig { kind: "aki-airdrop"; airdropChancePercent: AirdropChancePercent; - airdropMinOpenHeight: number; - airdropMaxOpenHeight: number; planeMinFlyHeight: number; planeMaxFlyHeight: number; planeVolume: number; airdropMinStartTimeSeconds: number; airdropMaxStartTimeSeconds: number; + loot: AirdropLoot; } export interface AirdropChancePercent { bigmap: number; @@ -18,3 +18,13 @@ export interface AirdropChancePercent { interchange: number; reserve: number; } +export interface AirdropLoot { + presetCount: MinMax; + itemCount: MinMax; + itemBlacklist: string[]; + itemTypeWhitelist: string[]; + /** key: item base type: value: max count */ + itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; +} diff --git a/Live/CWX_DeSharpener/server/types/models/spt/config/IBotConfig.d.ts b/Live/CWX_DeSharpener/server/types/models/spt/config/IBotConfig.d.ts index e171087..af8ceba 100644 --- a/Live/CWX_DeSharpener/server/types/models/spt/config/IBotConfig.d.ts +++ b/Live/CWX_DeSharpener/server/types/models/spt/config/IBotConfig.d.ts @@ -1,17 +1,31 @@ import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; +import { IBotDurability } from "./IBotDurability"; +import { IPmcConfig } from "./IPmcConfig"; export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; + /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** What bot types should be classified as bosses */ bosses: string[]; - durability: Durability; + /** Control weapon/armor durability min/max values for each bot type */ + durability: IBotDurability; + /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ lootNValue: LootNvalue; + /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; - pmc: PmcConfig; + /** PMC bot specific config settings */ + pmc: IPmcConfig; + /** Control how many items are allowed to spawn on a bot + * key: bottype, value: */ itemSpawnLimits: Record>; - equipment: Record; + /** Blacklist/whitelist items on a bot */ + equipment: Record; + /** Show a bots botType value after their name */ showTypeInNickname: boolean; - maxBotCap: number; + /** Max number of bots that can be spawned in a raid at any one time */ + maxBotCap: Record; + /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; } export interface PresetBatch { @@ -44,79 +58,23 @@ export interface PresetBatch { test: number; exUsec: number; } -export interface Durability { - default: DefaultDurability; - pmc: PmcDurability; - boss: BotDurability; - follower: BotDurability; - assault: BotDurability; - cursedassault: BotDurability; - marksman: BotDurability; - pmcbot: BotDurability; - exusec: BotDurability; - sectantpriest: BotDurability; - sectantwarrior: BotDurability; -} -export interface DefaultDurability { - armor: DefaultArmor; - weapon: WeaponDurability; -} -export interface DefaultArmor { - maxDelta: number; - minDelta: number; -} -export interface WeaponDurability { - lowestMax: number; - highestMax: number; - maxDelta: number; - minDelta: number; -} -export interface PmcDurability { - armor: PmcDurabilityArmor; - weapon: WeaponDurability; -} -export interface PmcDurabilityArmor { - lowestMaxPercent: number; - highestMaxPercent: number; - maxDelta: number; - minDelta: number; -} -export interface BotDurability { - armor: ArmorDurability; - weapon: WeaponDurability; -} -export interface ArmorDurability { - maxDelta: number; - minDelta: number; -} export interface LootNvalue { scav: number; pmc: number; } -export interface PmcConfig { - dynamicLoot: PmcDynamicLoot; - difficulty: string; - looseWeaponInBackpackChancePercent: number; - looseWeaponInBackpackLootMinMax: MinMax; - isUsec: number; - chanceSameSideIsHostilePercent: number; - usecType: string; - bearType: string; - maxBackpackLootTotalRub: number; - maxPocketLootTotalRub: number; - maxVestLootTotalRub: number; - convertIntoPmcChance: Record; - enemyTypes: string[]; -} -export interface PmcDynamicLoot { - whitelist: string[]; - blacklist: string[]; - moneyStackLimits: Record; -} -export interface Equipment { +export interface EquipmentFilters { + weaponModLimits: ModLimits; + randomisedWeaponModSlots?: string[]; + randomisedArmorSlots?: string[]; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; } +export interface ModLimits { + /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ + scopeLimit?: number; + /** How many lasers or lights are allowed on a weapon - hard coded to work with TACTICAL_COMBO, and FLASHLIGHT */ + lightLaserLimit?: number; +} export interface EquipmentFilterDetails { levelRange: MinMax; equipment: Record; diff --git a/Live/CWX_DeSharpener/server/types/models/spt/config/IBotDurability.d.ts b/Live/CWX_DeSharpener/server/types/models/spt/config/IBotDurability.d.ts new file mode 100644 index 0000000..38a47cc --- /dev/null +++ b/Live/CWX_DeSharpener/server/types/models/spt/config/IBotDurability.d.ts @@ -0,0 +1,47 @@ +export interface IBotDurability { + default: DefaultDurability; + pmc: PmcDurability; + boss: BotDurability; + follower: BotDurability; + assault: BotDurability; + cursedassault: BotDurability; + marksman: BotDurability; + pmcbot: BotDurability; + exusec: BotDurability; + gifter: BotDurability; + sectantpriest: BotDurability; + sectantwarrior: BotDurability; +} +/** Durability values to be used when a more specific bot type cant be found */ +export interface DefaultDurability { + armor: DefaultArmor; + weapon: WeaponDurability; +} +export interface DefaultArmor { + maxDelta: number; + minDelta: number; +} +export interface WeaponDurability { + lowestMax: number; + highestMax: number; + maxDelta: number; + minDelta: number; +} +export interface PmcDurability { + armor: PmcDurabilityArmor; + weapon: WeaponDurability; +} +export interface PmcDurabilityArmor { + lowestMaxPercent: number; + highestMaxPercent: number; + maxDelta: number; + minDelta: number; +} +export interface BotDurability { + armor: ArmorDurability; + weapon: WeaponDurability; +} +export interface ArmorDurability { + maxDelta: number; + minDelta: number; +} diff --git a/Live/CWX_DeSharpener/server/types/models/spt/config/IHideoutConfig.d.ts b/Live/CWX_DeSharpener/server/types/models/spt/config/IHideoutConfig.d.ts index 36d6246..f232052 100644 --- a/Live/CWX_DeSharpener/server/types/models/spt/config/IHideoutConfig.d.ts +++ b/Live/CWX_DeSharpener/server/types/models/spt/config/IHideoutConfig.d.ts @@ -2,6 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; runIntervalSeconds: number; - fuelDrainRateMultipler: number; hoursForSkillCrafting: number; + generatorSpeedWithoutFuel: number; + generatorFuelFlowRate: number; + airFilterUnitFlowRate: number; + /** SEE HIDEOUTHELPER BEFORE CHANGING CONFIG */ + gpuBoostRate: number; } diff --git a/Live/CWX_DeSharpener/server/types/models/spt/config/IItemConfig.d.ts b/Live/CWX_DeSharpener/server/types/models/spt/config/IItemConfig.d.ts new file mode 100644 index 0000000..5ecccc2 --- /dev/null +++ b/Live/CWX_DeSharpener/server/types/models/spt/config/IItemConfig.d.ts @@ -0,0 +1,5 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface IItemConfig extends IBaseConfig { + kind: "aki-item"; + blacklist: string[]; +} diff --git a/Live/CWX_DeSharpener/server/types/models/spt/config/IPmcConfig.d.ts b/Live/CWX_DeSharpener/server/types/models/spt/config/IPmcConfig.d.ts new file mode 100644 index 0000000..9db2ba1 --- /dev/null +++ b/Live/CWX_DeSharpener/server/types/models/spt/config/IPmcConfig.d.ts @@ -0,0 +1,26 @@ +import { MinMax } from "../../common/MinMax"; +export interface IPmcConfig { + dynamicLoot: DynamicLoot; + useDifficultyOverride: boolean; + difficulty: string; + looseWeaponInBackpackChancePercent: number; + looseWeaponInBackpackLootMinMax: MinMax; + isUsec: number; + chanceSameSideIsHostilePercent: number; + /** key: location, value: type for usec/bear */ + pmcType: Record; + maxBackpackLootTotalRub: number; + maxPocketLootTotalRub: number; + maxVestLootTotalRub: number; + convertIntoPmcChance: Record; + enemyTypes: string[]; +} +export interface PmcTypes { + usec: string; + bear: string; +} +export interface DynamicLoot { + whitelist: string[]; + blacklist: string[]; + moneyStackLimits: Record; +} diff --git a/Live/CWX_DeSharpener/server/types/models/spt/config/IQuestConfig.d.ts b/Live/CWX_DeSharpener/server/types/models/spt/config/IQuestConfig.d.ts index be4a97b..45c9aae 100644 --- a/Live/CWX_DeSharpener/server/types/models/spt/config/IQuestConfig.d.ts +++ b/Live/CWX_DeSharpener/server/types/models/spt/config/IQuestConfig.d.ts @@ -4,6 +4,8 @@ export interface IQuestConfig extends IBaseConfig { kind: "aki-quest"; redeemTime: number; repeatableQuests: IRepeatableQuestConfig[]; + bearOnlyQuests: string[]; + usecOnlyQuests: string[]; } export interface IRepeatableQuestConfig { name: string; @@ -15,6 +17,10 @@ export interface IRepeatableQuestConfig { locations: Record; traderWhitelist: ITraderWhitelist[]; questConfig: IQuestConfig; + /** Item base types to block when generating rewards */ + rewardBaseTypeBlacklist: string[]; + /** Item tplIds to ignore when generating rewards */ + rewardBlacklist: string[]; } export interface IRewardScaling { levels: number[]; diff --git a/Live/CWX_DeSharpener/server/types/models/spt/config/IRagfairConfig.d.ts b/Live/CWX_DeSharpener/server/types/models/spt/config/IRagfairConfig.d.ts index c24e617..c1b8763 100644 --- a/Live/CWX_DeSharpener/server/types/models/spt/config/IRagfairConfig.d.ts +++ b/Live/CWX_DeSharpener/server/types/models/spt/config/IRagfairConfig.d.ts @@ -12,6 +12,7 @@ export interface Sell { chance: Chance; time: Time; reputation: Reputation; + simulatedSellHours: number; } export interface Chance { base: number; @@ -27,11 +28,18 @@ export interface Reputation { gain: number; loss: number; } +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Dynamic { + offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; price: MinMax; presetPrice: MinMax; + showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; condition: Condition; stackablePercent: MinMax; diff --git a/Live/CWX_DeSharpener/server/types/models/spt/config/ITraderConfig.d.ts b/Live/CWX_DeSharpener/server/types/models/spt/config/ITraderConfig.d.ts index c8e8044..6b1c1e3 100644 --- a/Live/CWX_DeSharpener/server/types/models/spt/config/ITraderConfig.d.ts +++ b/Live/CWX_DeSharpener/server/types/models/spt/config/ITraderConfig.d.ts @@ -12,8 +12,10 @@ export interface UpdateTime { seconds: number; } export interface FenceConfig { + partialRefreshTimeSeconds: number; + partialRefreshChangePercent: number; assortSize: number; - maxPresetsCount: number; + maxPresetsPercent: number; presetPriceMult: number; blacklist: string[]; } diff --git a/Live/CWX_DeSharpener/server/types/models/spt/location/AirDropLootItem.d.ts b/Live/CWX_DeSharpener/server/types/models/spt/location/AirDropLootItem.d.ts new file mode 100644 index 0000000..da791ff --- /dev/null +++ b/Live/CWX_DeSharpener/server/types/models/spt/location/AirDropLootItem.d.ts @@ -0,0 +1,6 @@ +export declare class AirDropLootItem { + id: string; + tpl: string; + isPreset: boolean; + stackCount: number; +} diff --git a/Live/CWX_DeSharpener/server/types/models/spt/logging/LogBackgroundColor.d.ts b/Live/CWX_DeSharpener/server/types/models/spt/logging/LogBackgroundColor.d.ts index 87e08a9..1dd369b 100644 --- a/Live/CWX_DeSharpener/server/types/models/spt/logging/LogBackgroundColor.d.ts +++ b/Live/CWX_DeSharpener/server/types/models/spt/logging/LogBackgroundColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogBackgroundColor { - default = "", - black = "blackBG", - red = "redBG", - green = "greenBG", - yellow = "yellowBG", - blue = "blueBG", - magenta = "magentaBG", - cyan = "cyanBG", - white = "whiteBG" + DEFAULT = "", + BLACK = "blackBG", + RED = "redBG", + GREEN = "greenBG", + YELLOW = "yellowBG", + BLUE = "blueBG", + MAGENTA = "magentaBG", + CYAN = "cyanBG", + WHITE = "whiteBG" } diff --git a/Live/CWX_DeSharpener/server/types/models/spt/logging/LogTextColor.d.ts b/Live/CWX_DeSharpener/server/types/models/spt/logging/LogTextColor.d.ts index 7147ae3..6c7abf3 100644 --- a/Live/CWX_DeSharpener/server/types/models/spt/logging/LogTextColor.d.ts +++ b/Live/CWX_DeSharpener/server/types/models/spt/logging/LogTextColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogTextColor { - black = "black", - red = "red", - green = "green", - yellow = "yellow", - blue = "blue", - magenta = "magenta", - cyan = "cyan", - white = "white", - gray = "" + BLACK = "black", + RED = "red", + GREEN = "green", + YELLOW = "yellow", + BLUE = "blue", + MAGENTA = "magenta", + CYAN = "cyan", + WHITE = "white", + GRAY = "" } diff --git a/Live/CWX_DeSharpener/server/types/models/spt/server/ILocaleBase.d.ts b/Live/CWX_DeSharpener/server/types/models/spt/server/ILocaleBase.d.ts index 8887c06..6e20b89 100644 --- a/Live/CWX_DeSharpener/server/types/models/spt/server/ILocaleBase.d.ts +++ b/Live/CWX_DeSharpener/server/types/models/spt/server/ILocaleBase.d.ts @@ -13,10 +13,10 @@ export interface ILocaleGlobalBase { season: Record; customization: Record; repeatableQuest: Record; - templates: ILocaleTemplateBase; - locations: ILocaleLocationsBase; - banners: ILocaleBannersBase; - trading: ILocaleTradingBase; + templates: Record; + locations: Record; + banners: Record; + trading: Record; } export interface ILocaleQuest { name: string; @@ -31,23 +31,11 @@ export interface ILocaleQuest { export interface ILocalePreset { Name: string; } -export interface ILocaleTemplateBase { - templates: Record; -} -export interface ILocaleLocationsBase { - locations: Record; -} -export interface ILocaleBannersBase { - locations: Record; -} export interface ILocaleProps { Name: string; ShortName: string; Description: string; } -export interface ILocaleTradingBase { - locations: Record; -} export interface ILocaleTradingProps { FullName: string; FirstName: string; diff --git a/Live/CWX_DeSharpener/server/types/models/spt/services/LootItem.d.ts b/Live/CWX_DeSharpener/server/types/models/spt/services/LootItem.d.ts new file mode 100644 index 0000000..acb7606 --- /dev/null +++ b/Live/CWX_DeSharpener/server/types/models/spt/services/LootItem.d.ts @@ -0,0 +1,6 @@ +export declare class LootItem { + id?: string; + tpl: string; + isPreset: boolean; + stackCount: number; +} diff --git a/Live/CWX_DeSharpener/server/types/models/spt/services/LootRequest.d.ts b/Live/CWX_DeSharpener/server/types/models/spt/services/LootRequest.d.ts new file mode 100644 index 0000000..1da8770 --- /dev/null +++ b/Live/CWX_DeSharpener/server/types/models/spt/services/LootRequest.d.ts @@ -0,0 +1,11 @@ +import { MinMax } from "../../common/MinMax"; +export declare class LootRequest { + presetCount: MinMax; + itemCount: MinMax; + itemBlacklist: string[]; + itemTypeWhitelist: string[]; + /** key: item base type: value: max count */ + itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; +} diff --git a/Live/CWX_DeSharpener/server/types/servers/DatabaseServer.d.ts b/Live/CWX_DeSharpener/server/types/servers/DatabaseServer.d.ts index aa152d0..b3d29e9 100644 --- a/Live/CWX_DeSharpener/server/types/servers/DatabaseServer.d.ts +++ b/Live/CWX_DeSharpener/server/types/servers/DatabaseServer.d.ts @@ -2,5 +2,5 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; export declare class DatabaseServer { protected tableData: IDatabaseTables; getTables(): IDatabaseTables; - setTables(any: any): void; + setTables(tableData: IDatabaseTables): void; } diff --git a/Live/CWX_DeSharpener/server/types/servers/RagfairServer.d.ts b/Live/CWX_DeSharpener/server/types/servers/RagfairServer.d.ts index bc86cdb..c93864b 100644 --- a/Live/CWX_DeSharpener/server/types/servers/RagfairServer.d.ts +++ b/Live/CWX_DeSharpener/server/types/servers/RagfairServer.d.ts @@ -1,4 +1,6 @@ import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { TraderAssortHelper } from "../helpers/TraderAssortHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -12,11 +14,18 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected traderHelper: TraderHelper; + protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, configServer: ConfigServer); + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); load(): void; update(): void; + /** + * Get traders who need to be periodically refreshed + * @returns string array of traders + */ + protected getUpdateableTraders(): string[]; getAllCategories(): Record; getBespokeCategories(offers: IRagfairOffer[]): Record; /** diff --git a/Live/CWX_DeSharpener/server/types/services/BotEquipmentFilterService.d.ts b/Live/CWX_DeSharpener/server/types/services/BotEquipmentFilterService.d.ts index e49645b..632f961 100644 --- a/Live/CWX_DeSharpener/server/types/services/BotEquipmentFilterService.d.ts +++ b/Live/CWX_DeSharpener/server/types/services/BotEquipmentFilterService.d.ts @@ -1,12 +1,12 @@ import { IBotType } from "../models/eft/common/tables/IBotType"; -import { Equipment, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; protected configServer: ConfigServer; protected botConfig: IBotConfig; - protected botEquipmentFilterlists: Record; + protected botEquipmentFilterlists: Record; constructor(logger: ILogger, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig @@ -22,7 +22,7 @@ export declare class BotEquipmentFilterService { * @param playerLevel Level of the player * @returns EquipmentBlacklistDetails object */ - protected getBotEquipmentBlacklist(botRole: string, playerLevel: number): EquipmentFilterDetails; + getBotEquipmentBlacklist(botRole: string, playerLevel: number): EquipmentFilterDetails; /** * Get the whitelist for a specific bot type that's within the players level * @param botRole Bot type diff --git a/Live/CWX_DeSharpener/server/types/services/BotGenerationCacheService.d.ts b/Live/CWX_DeSharpener/server/types/services/BotGenerationCacheService.d.ts new file mode 100644 index 0000000..670c583 --- /dev/null +++ b/Live/CWX_DeSharpener/server/types/services/BotGenerationCacheService.d.ts @@ -0,0 +1,52 @@ +import { BotHelper } from "../helpers/BotHelper"; +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotGenerationCacheService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected botHelper: BotHelper; + protected storedBots: IBotBase[]; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); + /** + * Store array of bots in cache, shuffle results before storage + * @param botsToStore + */ + storeBots(botsToStore: IBotBase[]): void; + /** + * Find and return a bot based on its role + * Remove bot from internal array so it can't be retreived again + * @param role role to retreive (assault/bossTagilla etc) + * @returns IBotBase object + */ + getBot(role: string): IBotBase[]; + /** + * Find a bot by its index from cache + * @param indexOfBotToReturn index to find bot by + * @returns bot profile + */ + protected getBotFromCache(indexOfBotToReturn: number): IBotBase; + /** + * Remove bot profile by index from cache + * @param indexOfBotToReturn Index of bot profile to remove + */ + protected removeBotFromCache(indexOfBotToReturn: number): void; + /** + * Get index of bot profile that matches criteria + * @param role role of bot we want + * @param getPmc is requested bot a pmc + * @returns index of found bot + */ + protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; + /** + * Remove all cached bot profiles + */ + clearStoredBots(): void; + /** + * Does cache have bots + * @returns true if empty + */ + cacheIsEmpty(): boolean; +} diff --git a/Live/CWX_DeSharpener/server/types/services/BotLootCacheService.d.ts b/Live/CWX_DeSharpener/server/types/services/BotLootCacheService.d.ts index cc71eee..00ffb9c 100644 --- a/Live/CWX_DeSharpener/server/types/services/BotLootCacheService.d.ts +++ b/Live/CWX_DeSharpener/server/types/services/BotLootCacheService.d.ts @@ -34,6 +34,17 @@ export declare class BotLootCacheService { * @param isPmc Is the bot a PMC (alteres what loot is cached) */ protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; + /** + * Sort a pool of item objects by its flea price + * @param poolToSort pool of items to sort + */ + protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; + /** + * Add unique items into combined pool + * @param combinedItemPool Pool of items to add to + * @param itemsToAdd items to add to combined pool if unique + */ + protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; /** * Ammo/grenades have this property * @param props diff --git a/Live/CWX_DeSharpener/server/types/services/FenceService.d.ts b/Live/CWX_DeSharpener/server/types/services/FenceService.d.ts index 79058c6..23fbf52 100644 --- a/Live/CWX_DeSharpener/server/types/services/FenceService.d.ts +++ b/Live/CWX_DeSharpener/server/types/services/FenceService.d.ts @@ -11,29 +11,109 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; +import { ItemFilterService } from "./ItemFilterService"; +/** + * Handle actions surrounding Fence + * e.g. generating or refreshing assorts / get next refresh time + */ export declare class FenceService { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); + protected nextMiniRefreshTimestamp: number; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; - getFenceAssorts(): ITraderAssort; - hasExpiredCache(refreshAssort: boolean): boolean; - generateFenceAssortCache(pmcData: IPmcData): void; /** - * Get the fence level the passed in profile has + * Get assorts player can purchase + * Adjust prices based on fence level of player + * @param pmcProfile Player profile + * @returns ITraderAssort + */ + getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Get fence assorts with no price adjustments based on fence rep + * @returns ITraderAssort + */ + getRawFenceAssorts(): ITraderAssort; + /** + * Does fence need to perform a partial refresh because its passed the refresh timer defined in trader.json + * @returns true if it needs a partial refresh + */ + needsPartialRefresh(): boolean; + /** + * Replace a percentage of fence assorts with freshly generated items + */ + performPartialRefresh(): void; + /** + * Increment fence next refresh timestamp by current timestamp + partialRefreshTimeSeconds from config + */ + protected incrementPartialRefreshTime(): void; + /** + * Compare the current fence offer count to what the config wants it to be, + * If value is lower add extra count to value to generate more items to fill gap + * @param existingItemCountToReplace count of items to generate + * @returns number of items to generate + */ + protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + /** + * Choose an item (not mod) at random and remove from assorts + */ + protected removeRandomItemFromAssorts(): void; + /** + * Get an integer rounded count of items to replace based on percentrage from traderConfig value + * @param totalItemCount total item count + * @returns rounded int of items to replace + */ + protected getCountOfItemsToReplace(totalItemCount: number): number; + /** + * Get the count of items fence offers + * @returns number + */ + getOfferCount(): number; + /** + * Create a trader assort for fence + */ + generateFenceAssortCache(): void; + /** + * Create skeleton to hold assort items + * @returns ITraderAssort object + */ + protected createBaseTraderAssortItem(): ITraderAssort; + /** + * Hydrate result parameter object with generated assorts + * @param assortCount Number of assorts to generate + * @param assorts object to add assorts to + */ + protected createAssorts(assortCount: number, assorts: ITraderAssort): void; + /** + * Get the next update timestamp for fence + * @returns future timestamp + */ + getNextFenceUpdateTimestamp(): number; + /** + * Get fence refresh time in seconds + */ + protected getFenceRefreshTime(): number; + /** + * Get fence level the passed in profile has * @param pmcData Player profile - * @returns FenceLevel + * @returns FenceLevel object */ getFenceInfo(pmcData: IPmcData): FenceLevel; + /** + * Remove an assort from fence by id + * @param assortIdToRemove assort id to remove from fence assorts + */ removeFenceOffer(assortIdToRemove: string): void; - updateFenceOffers(pmcData: IPmcData): void; } diff --git a/Live/CWX_DeSharpener/server/types/services/InsuranceService.d.ts b/Live/CWX_DeSharpener/server/types/services/InsuranceService.d.ts index 171bf10..6be8a2f 100644 --- a/Live/CWX_DeSharpener/server/types/services/InsuranceService.d.ts +++ b/Live/CWX_DeSharpener/server/types/services/InsuranceService.d.ts @@ -2,6 +2,7 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { InsuredItem } from "../models/eft/common/tables/IBotBase"; import { Item } from "../models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; @@ -44,8 +45,22 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; + /** + * Store lost gear post-raid inside profile + * @param pmcData player profile to store gear in + * @param offraidData post-raid request object + * @param preRaidGear gear player wore prior to raid + * @param sessionID Session id + */ storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string): void; storeInsuredItemsForReturn(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string): void; - protected addGearToSend(pmcData: IPmcData, insuredItem: any, actualItem: any, sessionID: string): any; + /** + * Add gear item to InsuredItems array in player profile + * @param pmcData profile to store item in + * @param insuredItem Item to store in profile + * @param actualItem item to store + * @param sessionID Session id + */ + protected addGearToSend(pmcData: IPmcData, insuredItem: InsuredItem, actualItem: Item, sessionID: string): void; getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; } diff --git a/Live/CWX_DeSharpener/server/types/services/ItemFilterService.d.ts b/Live/CWX_DeSharpener/server/types/services/ItemFilterService.d.ts new file mode 100644 index 0000000..c9c8ef3 --- /dev/null +++ b/Live/CWX_DeSharpener/server/types/services/ItemFilterService.d.ts @@ -0,0 +1,24 @@ +import { IItemConfig } from "../models/spt/config/IItemConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +/** Centralise the handling of blacklisting items, uses blacklist found in config/item.json */ +export declare class ItemFilterService { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected blacklist: string[]; + protected itemConfig: IItemConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Check if the provided template id is blacklisted in config/item.json + * @param tpl template id + * @returns true if blacklisted + */ + isItemBlacklisted(tpl: string): boolean; + /** + * Return every template id blacklisted in config/item.json + * @returns string array of blacklisted tempalte ids + */ + getBlacklistedItems(): string[]; +} diff --git a/Live/CWX_DeSharpener/server/types/services/PmcAiService.d.ts b/Live/CWX_DeSharpener/server/types/services/PmcAiService.d.ts new file mode 100644 index 0000000..0690f1f --- /dev/null +++ b/Live/CWX_DeSharpener/server/types/services/PmcAiService.d.ts @@ -0,0 +1,27 @@ +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +/** Storing/retreving pmcRoles set at the start of a raid - its done at that point as we know what location the player is heading to */ +export declare class PmcAiService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + protected usecRole: string; + protected bearRole: string; + constructor(logger: ILogger, configServer: ConfigServer); + /** + * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) + * @param pmcSide eft side (usec/bear) + * @returns pmc side as defined in config + */ + getPmcRole(pmcSide: "usec" | "bear" | string): string; + /** + * Set the roles for pmcs + * @param location map location to look up and use as pmc types + */ + setPmcRolesByLocation(location: string): void; + /** + * Clear the saved role from usec/bear PMCs + */ + clearPmcRoles(): void; +} diff --git a/Live/CWX_DeSharpener/server/types/services/ProfileFixerService.d.ts b/Live/CWX_DeSharpener/server/types/services/ProfileFixerService.d.ts index ed1dec7..9cb5a38 100644 --- a/Live/CWX_DeSharpener/server/types/services/ProfileFixerService.d.ts +++ b/Live/CWX_DeSharpener/server/types/services/ProfileFixerService.d.ts @@ -45,6 +45,11 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to find and remove slots from */ protected removeResourcesFromSlotsInHideoutWithoutLocationIndexValue(pmcProfile: IPmcData): void; + /** + * Hideout slots need to be in a specific order, locationIndex in ascending order + * @param pmcProfile profile to edit + */ + protected reorderHideoutAreasWithResouceInputs(pmcProfile: IPmcData): void; /** * add in objects equal to the number of slots * @param areaType area to check diff --git a/Live/CWX_DeSharpener/server/types/services/ProfileSnapshotService.d.ts b/Live/CWX_DeSharpener/server/types/services/ProfileSnapshotService.d.ts new file mode 100644 index 0000000..445ffd0 --- /dev/null +++ b/Live/CWX_DeSharpener/server/types/services/ProfileSnapshotService.d.ts @@ -0,0 +1,30 @@ +import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { JsonUtil } from "../utils/JsonUtil"; +export declare class ProfileSnapshotService { + protected jsonUtil: JsonUtil; + protected storedProfileSnapshots: Record; + constructor(jsonUtil: JsonUtil); + /** + * Store a profile into an in-memory object + * @param sessionID session id - acts as the key + * @param profile - profile to save + */ + storeProfileSnapshot(sessionID: string, profile: IAkiProfile): void; + /** + * Retreve a stored profile + * @param sessionID key + * @returns A player profile object + */ + getProfileSnapshot(sessionID: string): IAkiProfile; + /** + * Does a profile exists against the provided key + * @param sessionID key + * @returns true if exists + */ + hasProfileSnapshot(sessionID: string): boolean; + /** + * Remove a stored profile by key + * @param sessionID key + */ + clearProfileSnapshot(sessionID: string): void; +} diff --git a/Live/CWX_DeSharpener/server/types/services/RagfairOfferService.d.ts b/Live/CWX_DeSharpener/server/types/services/RagfairOfferService.d.ts index 7398a8f..f9e3a34 100644 --- a/Live/CWX_DeSharpener/server/types/services/RagfairOfferService.d.ts +++ b/Live/CWX_DeSharpener/server/types/services/RagfairOfferService.d.ts @@ -24,7 +24,6 @@ export declare class RagfairOfferService { protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected toUpdate: Record; protected expiredOffers: Item[]; protected offers: IRagfairOffer[]; protected ragfairConfig: IRagfairConfig; @@ -38,8 +37,6 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; - setTraderUpdateStatus(traderId: string, shouldUpdate: boolean): void; - shouldTraderBeUpdated(traderID: string): boolean; getExpiredOfferCount(): number; /** * Get an array of expired items not yet processed into new offers @@ -53,12 +50,15 @@ export declare class RagfairOfferService { * @returns offer exists - true */ doesOfferExist(offerId: string): boolean; - getTraders(): Record; - flagTraderForUpdate(expiredOfferUserId: string): void; removeOfferById(offerId: string): void; removeOfferStack(offerID: string, amount: number): void; removeAllOffersByTrader(traderId: string): void; - addTradersToUpdateList(): void; + /** + * Do the trader offers on flea need to be refreshed + * @param traderID Trader to check + * @returns true if they do + */ + traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; /** diff --git a/Live/CWX_DeSharpener/server/types/services/RagfairPriceService.d.ts b/Live/CWX_DeSharpener/server/types/services/RagfairPriceService.d.ts index 679fe1d..466c9e3 100644 --- a/Live/CWX_DeSharpener/server/types/services/RagfairPriceService.d.ts +++ b/Live/CWX_DeSharpener/server/types/services/RagfairPriceService.d.ts @@ -27,6 +27,20 @@ export declare class RagfairPriceService { getDynamicPrice(itemTpl: string): number; getAllFleaPrices(): Record; getFleaPriceForItem(tplId: string): number; + /** + * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * @param itemPrice price of item + * @param itemTpl item template Id being checked + * @returns adjusted price value in roubles + */ + protected adjustPriceIfBelowHandbook(itemPrice: number, itemTpl: string): number; + /** + * Get the percentage difference between two values + * @param a numerical value a + * @param b numerical value b + * @returns different in percent + */ + protected getPriceDifference(a: number, b: number): number; getStaticPriceForItem(tplId: string): number; getBarterPrice(barterScheme: IBarterScheme[]): number; getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; diff --git a/Live/CWX_DeSharpener/server/types/services/RepairService.d.ts b/Live/CWX_DeSharpener/server/types/services/RepairService.d.ts new file mode 100644 index 0000000..3e6077c --- /dev/null +++ b/Live/CWX_DeSharpener/server/types/services/RepairService.d.ts @@ -0,0 +1,75 @@ +import { QuestHelper } from "../helpers/QuestHelper"; +import { RepairHelper } from "../helpers/RepairHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { RepairKitsInfo } from "../models/eft/repair/IRepairActionDataRequest"; +import { RepairItem } from "../models/eft/repair/ITraderRepairActionDataRequest"; +import { IRepairConfig } from "../models/spt/config/IRepairConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ItemEventRouter } from "../routers/ItemEventRouter"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { PaymentService } from "./PaymentService"; +export declare class RepairService { + protected logger: ILogger; + protected itemEventRouter: ItemEventRouter; + protected databaseServer: DatabaseServer; + protected questHelper: QuestHelper; + protected traderHelper: TraderHelper; + protected paymentService: PaymentService; + protected repairHelper: RepairHelper; + protected configServer: ConfigServer; + repairConfig: IRepairConfig; + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + /** + * Use trader to repair an items durability + * @param sessionID Session id + * @param pmcData profile to find item to repair in + * @param repairItemDetails details of the item to repair + * @param traderId Trader being used to repair item + * @returns RepairDetails object + */ + repairItemByTrader(sessionID: string, pmcData: IPmcData, repairItemDetails: RepairItem, traderId: string): RepairDetails; + /** + * + * @param sessionID Session id + * @param pmcData profile to take money from + * @param repairedItemId Repaired item id + * @param repairCost Cost to repair item in roubles + * @param traderId Id of the trader who repaired the item / who is paid + * @param output + */ + payForRepair(sessionID: string, pmcData: IPmcData, repairedItemId: string, repairCost: number, traderId: string, output: IItemEventRouterResponse): void; + /** + * Add skill points to profile after repairing an item + * @param sessionId Session id + * @param repairDetails details of item repaired, cost/item + * @param pmcData Profile to add points to + * @param output IItemEventRouterResponse + */ + addRepairSkillPoints(sessionId: string, repairDetails: RepairDetails, pmcData: IPmcData, output: IItemEventRouterResponse): void; + /** + * + * @param sessionId Session id + * @param pmcData Profile to update repaired item in + * @param repairKits Array of Repair kits to use + * @param itemToRepairId Item id to repair + * @param output IItemEventRouterResponse + * @returns Details of repair, item/price + */ + repairItemByKit(sessionId: string, pmcData: IPmcData, repairKits: RepairKitsInfo[], itemToRepairId: string, output: IItemEventRouterResponse): RepairDetails; + /** + * Update repair kits Resource object if it doesn't exist + * @param repairKitDetails Repair kit details from db + * @param repairKitInInventory Repair kit to update + */ + protected addMaxResourceToKitIfMissing(repairKitDetails: ITemplateItem, repairKitInInventory: Item): void; +} +export declare class RepairDetails { + repairCost?: number; + repairedItem: Item; + repairedItemIsArmor: boolean; +} diff --git a/Live/CWX_DeSharpener/server/types/services/TraderAssortService.d.ts b/Live/CWX_DeSharpener/server/types/services/TraderAssortService.d.ts index 5ba2d05..03b4e12 100644 --- a/Live/CWX_DeSharpener/server/types/services/TraderAssortService.d.ts +++ b/Live/CWX_DeSharpener/server/types/services/TraderAssortService.d.ts @@ -2,5 +2,10 @@ import { ITraderAssort } from "../models/eft/common/tables/ITrader"; export declare class TraderAssortService { protected pristineTraderAssorts: Record; getPristineTraderAssort(traderId: string): ITraderAssort; + /** + * Store trader assorts inside a class property + * @param traderId Traderid to store assorts against + * @param assort Assorts to store + */ setPristineTraderAssort(traderId: string, assort: ITraderAssort): void; } diff --git a/Live/CWX_DeSharpener/server/types/utils/HashUtil.d.ts b/Live/CWX_DeSharpener/server/types/utils/HashUtil.d.ts index bacbf2a..a8500e1 100644 --- a/Live/CWX_DeSharpener/server/types/utils/HashUtil.d.ts +++ b/Live/CWX_DeSharpener/server/types/utils/HashUtil.d.ts @@ -4,8 +4,18 @@ import { TimeUtil } from "./TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; constructor(timeUtil: TimeUtil); + /** + * Create a 24 character id using the sha256 algorithm + current timestamp + * @returns 24 character hash + */ generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + /** + * Create a hash for the data parameter + * @param algorithm algorithm to use to hash + * @param data data to be hashed + * @returns hash value + */ generateHashForData(algorithm: string, data: crypto.BinaryLike): string; } diff --git a/Live/CWX_DeSharpener/server/types/utils/RandomUtil.d.ts b/Live/CWX_DeSharpener/server/types/utils/RandomUtil.d.ts index c24dd60..633e472 100644 --- a/Live/CWX_DeSharpener/server/types/utils/RandomUtil.d.ts +++ b/Live/CWX_DeSharpener/server/types/utils/RandomUtil.d.ts @@ -136,7 +136,7 @@ export declare class RandomUtil { * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with ot without replacement from the input array + * @param {boolean} replacement Draw with or without replacement from the input array * @return {array} Array consisting of N random elements */ drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; @@ -150,4 +150,10 @@ export declare class RandomUtil { */ drawRandomFromDict(dict: any, count?: number, replacement?: boolean): any[]; getBiasedRandomNumber(min: number, max: number, shift: number, n: number): number; + /** + * Fisher-Yates shuffle an array + * @param array Array to shuffle + * @returns Shuffled array + */ + shuffle(array: Array): Array; } diff --git a/Live/CWX_DeSharpener/server/types/utils/TimeUtil.d.ts b/Live/CWX_DeSharpener/server/types/utils/TimeUtil.d.ts index eed4e6d..1367e26 100644 --- a/Live/CWX_DeSharpener/server/types/utils/TimeUtil.d.ts +++ b/Live/CWX_DeSharpener/server/types/utils/TimeUtil.d.ts @@ -1,9 +1,16 @@ +/** + * Utility class to handle time related problems + */ export declare class TimeUtil { static readonly oneHourAsSeconds = 3600; formatTime(date: Date): string; formatDate(date: Date): string; getDate(): string; getTime(): string; + /** + * Get timestamp in seconds + * @returns + */ getTimestamp(): number; /** * mail in eft requires time be in a specific format @@ -15,4 +22,10 @@ export declare class TimeUtil { * @returns current date in format: 00.00.0000 (dd.mm.yyyy) */ getDateMailFormat(): string; + /** + * Convert hours into seconds + * @param hours hours to convert to seconds + * @returns number + */ + getHoursAsSeconds(hours: number): number; } diff --git a/Live/CWX_DebugTool/config/config.json b/Live/CWX_DebugTool/config/config.json index 1a84035..d4ad390 100644 --- a/Live/CWX_DebugTool/config/config.json +++ b/Live/CWX_DebugTool/config/config.json @@ -18,6 +18,7 @@ }, "itemsConfig": { "changeShrapProps": true, - "changeMaxAmmoForKS23": true + "changeMaxAmmoForKS23": true, + "removeDevFromBlacklist": true } } \ No newline at end of file diff --git a/Live/CWX_DebugTool/dist/config/config.json b/Live/CWX_DebugTool/dist/config/config.json index 1a84035..d4ad390 100644 --- a/Live/CWX_DebugTool/dist/config/config.json +++ b/Live/CWX_DebugTool/dist/config/config.json @@ -18,6 +18,7 @@ }, "itemsConfig": { "changeShrapProps": true, - "changeMaxAmmoForKS23": true + "changeMaxAmmoForKS23": true, + "removeDevFromBlacklist": true } } \ No newline at end of file diff --git a/Live/CWX_DebugTool/dist/models/IConfig.ts b/Live/CWX_DebugTool/dist/models/IConfig.ts index 3f160f3..29dda5d 100644 --- a/Live/CWX_DebugTool/dist/models/IConfig.ts +++ b/Live/CWX_DebugTool/dist/models/IConfig.ts @@ -36,4 +36,5 @@ export interface itemsConfig { changeShrapProps: boolean changeMaxAmmoForKS23: boolean + removeDevFromBlacklist: boolean } \ No newline at end of file diff --git a/Live/CWX_DebugTool/dist/src/itemsConfig.ts b/Live/CWX_DebugTool/dist/src/itemsConfig.ts index d1f7258..5762e0d 100644 --- a/Live/CWX_DebugTool/dist/src/itemsConfig.ts +++ b/Live/CWX_DebugTool/dist/src/itemsConfig.ts @@ -3,16 +3,21 @@ import { inject, injectable } from "tsyringe"; import { CWX_ConfigHandler } from "./configHandler"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig" import { IConfig } from "models/IConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes"; @injectable() export class CWX_ItemsConfig { private tables: Record; private config: IConfig; + private itemConfig: IItemConfig; constructor( @inject("DatabaseServer") private databaseServer: DatabaseServer, + @inject("ConfigServer") private configServer: ConfigServer, @inject("CWX_ConfigHandler") private configHandler: CWX_ConfigHandler ) {} @@ -20,11 +25,14 @@ export class CWX_ItemsConfig public applyChanges(): void { this.tables = this.databaseServer.getTables().templates.items; + this.itemConfig = this.configServer.getConfig(ConfigTypes.ITEM); this.config = this.configHandler.getConfig(); this.changeShrapProps(); this.changeMaxAmmoForKS23(); + this.removeDevFromBlacklist(); } + private changeShrapProps(): void { @@ -46,4 +54,12 @@ export class CWX_ItemsConfig ks23._props.Cartridges[0]._max_count = 30; } } + + private removeDevFromBlacklist(): void + { + if (this.config.itemsConfig.removeDevFromBlacklist) + { + this.itemConfig.blacklist.splice(this.itemConfig.blacklist.indexOf("58ac60eb86f77401897560ff")); + } + } } \ No newline at end of file diff --git a/Live/CWX_DebugTool/dist/types/callbacks/LocationCallbacks.d.ts b/Live/CWX_DebugTool/dist/types/callbacks/LocationCallbacks.d.ts index cc69369..6e0b538 100644 --- a/Live/CWX_DebugTool/dist/types/callbacks/LocationCallbacks.d.ts +++ b/Live/CWX_DebugTool/dist/types/callbacks/LocationCallbacks.d.ts @@ -11,4 +11,5 @@ export declare class LocationCallbacks { constructor(httpResponse: HttpResponseUtil, locationController: LocationController); getLocationData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocation(url: string, info: IGetLocationRequestData, sessionID: string): IGetBodyResponseData; + getAirdropLoot(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/Live/CWX_DebugTool/dist/types/callbacks/ProfileCallbacks.d.ts b/Live/CWX_DebugTool/dist/types/callbacks/ProfileCallbacks.d.ts index 6a86fc0..183bb0a 100644 --- a/Live/CWX_DebugTool/dist/types/callbacks/ProfileCallbacks.d.ts +++ b/Live/CWX_DebugTool/dist/types/callbacks/ProfileCallbacks.d.ts @@ -1,5 +1,6 @@ import { ProfileController } from "../controllers/ProfileController"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IGetMiniProfileRequestData } from "../models/eft/launcher/IGetMiniProfileRequestData"; @@ -12,20 +13,51 @@ import { ISearchFriendResponse } from "../models/eft/profile/ISearchFriendRespon import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** Handle profile related client events */ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); createProfile(url: string, info: IProfileCreateRequestData, sessionID: string): IGetBodyResponseData; - getProfileData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - regenerateScav(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Get the complete player profile (scav + pmc character) + * @param url + * @param info Empty + * @param sessionID Session id + * @returns Profile object + */ + getProfileData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle the creation of a scav profile for player + * Occurs post-raid and when profile first created immediately after character details are confirmed by player + * @param url + * @param info empty + * @param sessionID Session id + * @returns Profile object + */ + regenerateScav(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/profile/voice/change event + * @param url + * @param info Change voice request object + * @param sessionID Session id + * @returns Client response + */ changeVoice(url: string, info: IProfileChangeVoiceRequestData, sessionID: string): INullResponseData; + /** + * Handle client/game/profile/nickname/change event + * Client allows player to adjust their profile name + * @param url + * @param info Change nickname request object + * @param sessionID Session id + * @returns client response + */ changeNickname(url: string, info: IProfileChangeNicknameRequestData, sessionID: string): IGetBodyResponseData; validateNickname(url: string, info: IValidateNicknameRequestData, sessionID: string): IGetBodyResponseData; getReservedNickname(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** - * Called when creating a character, when you choose a character face/voice + * Called when creating a character when choosing a character face/voice * @param url * @param info response (empty) * @param sessionID diff --git a/Live/CWX_DebugTool/dist/types/callbacks/RagfairCallbacks.d.ts b/Live/CWX_DebugTool/dist/types/callbacks/RagfairCallbacks.d.ts index 3a405c9..c609f2f 100644 --- a/Live/CWX_DebugTool/dist/types/callbacks/RagfairCallbacks.d.ts +++ b/Live/CWX_DebugTool/dist/types/callbacks/RagfairCallbacks.d.ts @@ -19,6 +19,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; +/** + * Handle ragfair related callback events + */ export declare class RagfairCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; protected logger: ILogger; diff --git a/Live/CWX_DebugTool/dist/types/callbacks/RepairCallbacks.d.ts b/Live/CWX_DebugTool/dist/types/callbacks/RepairCallbacks.d.ts index 63733fa..14edeeb 100644 --- a/Live/CWX_DebugTool/dist/types/callbacks/RepairCallbacks.d.ts +++ b/Live/CWX_DebugTool/dist/types/callbacks/RepairCallbacks.d.ts @@ -6,6 +6,20 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa export declare class RepairCallbacks { protected repairController: RepairController; constructor(repairController: RepairController); + /** + * use trader to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + /** + * Use repair kit to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ repair(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/Live/CWX_DebugTool/dist/types/context/ContextVariable.d.ts b/Live/CWX_DebugTool/dist/types/context/ContextVariable.d.ts index e438947..0fe0a63 100644 --- a/Live/CWX_DebugTool/dist/types/context/ContextVariable.d.ts +++ b/Live/CWX_DebugTool/dist/types/context/ContextVariable.d.ts @@ -4,7 +4,7 @@ export declare class ContextVariable { private timestamp; private type; constructor(value: any, type: ContextVariableType); - getValue(): any; + getValue(): T; getTimestamp(): Date; getType(): ContextVariableType; } diff --git a/Live/CWX_DebugTool/dist/types/controllers/BotController.d.ts b/Live/CWX_DebugTool/dist/types/controllers/BotController.d.ts index 5e6f05d..a5111d5 100644 --- a/Live/CWX_DebugTool/dist/types/controllers/BotController.d.ts +++ b/Live/CWX_DebugTool/dist/types/controllers/BotController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotHelper } from "../helpers/BotHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; @@ -5,15 +6,22 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { IBotCore } from "../models/eft/common/tables/IBotCore"; import { Difficulty } from "../models/eft/common/tables/IBotType"; import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; +import { PmcAiService } from "../services/PmcAiService"; export declare class BotController { + protected logger: ILogger; protected databaseServer: DatabaseServer; protected botGenerator: BotGenerator; protected botHelper: BotHelper; + protected pmcAiService: PmcAiService; + protected botGenerationCacheService: BotGenerationCacheService; protected configServer: ConfigServer; + protected applicationContext: ApplicationContext; protected botConfig: IBotConfig; - constructor(databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -29,7 +37,18 @@ export declare class BotController { * @returns Difficulty object */ getBotDifficulty(type: string, difficulty: string): Difficulty; - protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string): Difficulty; + protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Generate bot profiles and store in cache + * @param sessionId Session id + * @param info bot generation request info + * @returns IBotBase array + */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the max number of bots allowed on a map + * Looks up location player is entering when getting cap value + * @returns cap number + */ getBotCap(): number; } diff --git a/Live/CWX_DebugTool/dist/types/controllers/GameController.d.ts b/Live/CWX_DebugTool/dist/types/controllers/GameController.d.ts index d374453..2d00898 100644 --- a/Live/CWX_DebugTool/dist/types/controllers/GameController.d.ts +++ b/Live/CWX_DebugTool/dist/types/controllers/GameController.d.ts @@ -7,11 +7,13 @@ import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; protected localeService: LocaleService; @@ -20,8 +22,12 @@ export declare class GameController { protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + /** + * Make non-trigger-spawned raiders spawn earlier + always + */ + protected adjustLabsRaiderSpawnRate(): void; protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; diff --git a/Live/CWX_DebugTool/dist/types/controllers/InraidController.d.ts b/Live/CWX_DebugTool/dist/types/controllers/InraidController.d.ts index 82bb64d..102a2fb 100644 --- a/Live/CWX_DebugTool/dist/types/controllers/InraidController.d.ts +++ b/Live/CWX_DebugTool/dist/types/controllers/InraidController.d.ts @@ -35,6 +35,30 @@ export declare class InraidController { constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Handle updating the profile post-pmc raid + * @param sessionID session id + * @param offraidData post-raid data of raid + */ + protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Reduce body part hp to % of max + * @param pmcData profile to edit + * @param multipler multipler to apply to max health + */ + protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + /** + * Handle updating the profile post-pscav raid + * @param sessionID session id + * @param offraidData post-raid data of raid + */ + protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Is the player dead after a raid - dead is anything other than "survived" / "runner" + * @param statusOnExit exit value from offraidData object + * @returns true if dead + */ + protected isPlayerDead(statusOnExit: string): boolean; /** * Mark inventory items as FiR if player survived raid, otherwise remove FiR from them * @param offraidData Save Progress Request diff --git a/Live/CWX_DebugTool/dist/types/controllers/InventoryController.d.ts b/Live/CWX_DebugTool/dist/types/controllers/InventoryController.d.ts index f57f731..f564919 100644 --- a/Live/CWX_DebugTool/dist/types/controllers/InventoryController.d.ts +++ b/Live/CWX_DebugTool/dist/types/controllers/InventoryController.d.ts @@ -92,7 +92,11 @@ export declare class InventoryController { */ toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; /** - * Handles Tagging of items (primary Containers). + * Add a tag to an inventory item + * @param pmcData profile with item to add tag to + * @param body tag request data + * @param sessionID session id + * @returns client response object */ tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/Live/CWX_DebugTool/dist/types/controllers/LocationController.d.ts b/Live/CWX_DebugTool/dist/types/controllers/LocationController.d.ts index 90b6d7a..9db3205 100644 --- a/Live/CWX_DebugTool/dist/types/controllers/LocationController.d.ts +++ b/Live/CWX_DebugTool/dist/types/controllers/LocationController.d.ts @@ -1,18 +1,33 @@ import { LocationGenerator } from "../generators/LocationGenerator"; +import { LootGenerator } from "../generators/LootGenerator"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; +import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; +import { LootItem } from "../models/spt/services/LootItem"; import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class LocationController { protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected logger: ILogger; protected locationGenerator: LocationGenerator; + protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; - constructor(jsonUtil: JsonUtil, logger: ILogger, locationGenerator: LocationGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil); + protected configServer: ConfigServer; + protected airdropConfig: IAirdropConfig; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; generateAll(): ILocationsGenerateAllResponse; + /** + * Get loot for an airdop container + * Generates it randomly based on config/airdrop.json values + * @returns Array of LootItem + */ + getAirdropLoot(): LootItem[]; } diff --git a/Live/CWX_DebugTool/dist/types/controllers/MatchController.d.ts b/Live/CWX_DebugTool/dist/types/controllers/MatchController.d.ts index e8585d9..07f6a89 100644 --- a/Live/CWX_DebugTool/dist/types/controllers/MatchController.d.ts +++ b/Live/CWX_DebugTool/dist/types/controllers/MatchController.d.ts @@ -9,13 +9,16 @@ import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestDa import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; +import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { PmcAiService } from "../services/PmcAiService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { protected logger: ILogger; @@ -26,10 +29,13 @@ export declare class MatchController { protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; + protected pmcAiService: PmcAiService; + protected botGenerationCacheService: BotGenerationCacheService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, applicationContext: ApplicationContext); + protected botConfig: IBotConfig; + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/Live/CWX_DebugTool/dist/types/controllers/QuestController.d.ts b/Live/CWX_DebugTool/dist/types/controllers/QuestController.d.ts index 2cbccfb..282f50e 100644 --- a/Live/CWX_DebugTool/dist/types/controllers/QuestController.d.ts +++ b/Live/CWX_DebugTool/dist/types/controllers/QuestController.d.ts @@ -39,16 +39,31 @@ export declare class QuestController { * @returns array of IQuest */ getClientQuests(sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param side player side (usec/bear) + * @param questId questId to check + */ + protected questIsForOtherSide(side: string, questId: string): boolean; + /** + * Handle the client accepting a quest and starting it + * Send starting rewards if any to player and + * Send start notification if any to player + * @param pmcData Profile to update + * @param acceptedQuest Quest accepted + * @param sessionID Session id + * @returns client response + */ acceptQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; acceptRepeatableQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; /** - * Remove completed quest from profile + * Update completed quest in profile * Add newly unlocked quests to profile * Also recalculate thier level due to exp rewards * @param pmcData Player profile - * @param body completed quest request - * @param sessionID session id - * @returns ItemEvent response + * @param body Completed quest request + * @param sessionID Session id + * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -67,10 +82,20 @@ export declare class QuestController { protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the quests provided + * Update quest in profile, otherwise add fresh quest object with failed status * @param sessionID session id * @param pmcData player profile * @param questsToFail quests to fail */ protected failQuests(sessionID: string, pmcData: IPmcData, questsToFail: IQuest[]): void; handoverQuest(pmcData: IPmcData, body: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Increment a backend counter stored value by an amount, + * Create counter if it does not exist + * @param pmcData Profile to find backend counter in + * @param conditionId backend counter id to update + * @param questId quest id counter is associated with + * @param counterValue value to increment the backend counter with + */ + protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; } diff --git a/Live/CWX_DebugTool/dist/types/controllers/RagfairController.d.ts b/Live/CWX_DebugTool/dist/types/controllers/RagfairController.d.ts index c4ffc15..06af740 100644 --- a/Live/CWX_DebugTool/dist/types/controllers/RagfairController.d.ts +++ b/Live/CWX_DebugTool/dist/types/controllers/RagfairController.d.ts @@ -9,6 +9,7 @@ import { RagfairOfferHelper } from "../helpers/RagfairOfferHelper"; import { RagfairSellHelper } from "../helpers/RagfairSellHelper"; import { RagfairSortHelper } from "../helpers/RagfairSortHelper"; import { RagfairTaxHelper } from "../helpers/RagfairTaxHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; @@ -33,6 +34,9 @@ import { RagfairPriceService } from "../services/RagfairPriceService"; import { RagfairRequiredItemsService } from "../services/RagfairRequiredItemsService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** + * Handle RagfairCallback events + */ export declare class RagfairController { protected logger: ILogger; protected timeUtil: TimeUtil; @@ -52,14 +56,20 @@ export declare class RagfairController { protected handbookHelper: HandbookHelper; protected paymentHelper: PaymentHelper; protected inventoryHelper: InventoryHelper; + protected traderHelper: TraderHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected ragfairOfferGenerator: RagfairOfferGenerator; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + /** + * Update a trader flea offer with buy restrictions stored in the traders assort + * @param offer flea offer to update + */ + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer): void; protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; diff --git a/Live/CWX_DebugTool/dist/types/controllers/RepairController.d.ts b/Live/CWX_DebugTool/dist/types/controllers/RepairController.d.ts index 0e78ef6..ae54a53 100644 --- a/Live/CWX_DebugTool/dist/types/controllers/RepairController.d.ts +++ b/Live/CWX_DebugTool/dist/types/controllers/RepairController.d.ts @@ -8,9 +8,9 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa import { IRepairConfig } from "../models/spt/config/IRepairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; -import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { PaymentService } from "../services/PaymentService"; +import { RepairService } from "../services/RepairService"; export declare class RepairController { protected logger: ILogger; protected itemEventRouter: ItemEventRouter; @@ -19,23 +19,23 @@ export declare class RepairController { protected traderHelper: TraderHelper; protected paymentService: PaymentService; protected repairHelper: RepairHelper; - protected configServer: ConfigServer; + protected repairService: RepairService; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); /** * Repair with trader - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + traderRepair(sessionID: string, body: ITraderRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; /** * Repair with repair kit - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - repairWithKit(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + repairWithKit(sessionID: string, body: IRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; } diff --git a/Live/CWX_DebugTool/dist/types/controllers/RepeatableQuestController.d.ts b/Live/CWX_DebugTool/dist/types/controllers/RepeatableQuestController.d.ts index 98d05dd..4c31a3d 100644 --- a/Live/CWX_DebugTool/dist/types/controllers/RepeatableQuestController.d.ts +++ b/Live/CWX_DebugTool/dist/types/controllers/RepeatableQuestController.d.ts @@ -7,6 +7,7 @@ import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; import { TraderInfo } from "../models/eft/common/tables/IBotBase"; import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; import { ELocationName } from "../models/enums/ELocationName"; @@ -15,6 +16,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -64,9 +66,10 @@ export declare class RepeatableQuestController { protected itemEventRouter: ItemEventRouter; protected paymentService: PaymentService; protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. @@ -217,4 +220,16 @@ export declare class RepeatableQuestController { debugLogRepeatableQuestIds(pmcData: IPmcData): void; probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; changeRepeatableQuest(pmcDataIn: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {*} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; } diff --git a/Live/CWX_DebugTool/dist/types/controllers/TraderController.d.ts b/Live/CWX_DebugTool/dist/types/controllers/TraderController.d.ts index 0162064..b79f55e 100644 --- a/Live/CWX_DebugTool/dist/types/controllers/TraderController.d.ts +++ b/Live/CWX_DebugTool/dist/types/controllers/TraderController.d.ts @@ -4,6 +4,7 @@ import { TraderHelper } from "../helpers/TraderHelper"; import { IBarterScheme, ITraderAssort, ITraderBase } from "../models/eft/common/tables/ITrader"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -15,8 +16,9 @@ export declare class TraderController { protected traderHelper: TraderHelper; protected timeUtil: TimeUtil; protected traderAssortService: TraderAssortService; + protected fenceService: FenceService; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, fenceService: FenceService, jsonUtil: JsonUtil); /** * Runs when onLoad event is fired * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService @@ -26,6 +28,7 @@ export declare class TraderController { /** * Runs when onUpdate is fired * If current time is > nextResupply(expire) time of trader, refresh traders assorts and + * Fence is handled slightly differently * @returns has run */ update(): boolean; diff --git a/Live/CWX_DebugTool/dist/types/di/Container.d.ts b/Live/CWX_DebugTool/dist/types/di/Container.d.ts index 17791b0..98d1fa1 100644 --- a/Live/CWX_DebugTool/dist/types/di/Container.d.ts +++ b/Live/CWX_DebugTool/dist/types/di/Container.d.ts @@ -1,4 +1,7 @@ import { DependencyContainer } from "tsyringe"; +/** + * Handle the registration of classes to be used by the Dependency Injection code + */ export declare class Container { static registerTypes(depContainer: DependencyContainer): void; static registerListTypes(depContainer: DependencyContainer): void; diff --git a/Live/CWX_DebugTool/dist/types/generators/BotGenerator.d.ts b/Live/CWX_DebugTool/dist/types/generators/BotGenerator.d.ts index a5fc0ad..2ac51db 100644 --- a/Live/CWX_DebugTool/dist/types/generators/BotGenerator.d.ts +++ b/Live/CWX_DebugTool/dist/types/generators/BotGenerator.d.ts @@ -9,6 +9,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { PmcAiService } from "../services/PmcAiService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -30,9 +31,10 @@ export declare class BotGenerator { protected botEquipmentFilterService: BotEquipmentFilterService; protected botHelper: BotHelper; protected gameEventHelper: GameEventHelper; + protected pmcAiService: PmcAiService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, pmcAiService: PmcAiService, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -40,14 +42,14 @@ export declare class BotGenerator { * @param botTemplate base bot template to use (e.g. assault/pmcbot) * @returns */ - generatePlayerScav(role: string, difficulty: string, botTemplate: IBotType): IBotBase; - generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Choose if a bot should become a PMC by checking if bot type is allowed to become a Pmc in botConfig.convertFromChances and doing a random int check - * @param botRole the bot role to check if should be a pmc - * @returns true if should be a pmc + * Generate an array of bot objects for populate a raid with + * @param sessionId session id + * @param info request object + * @returns bot array */ - protected shouldBotBePmc(botRole: string): boolean; + generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** * Get a randomised PMC side based on bot config value 'isUsec' * @returns pmc side as string @@ -58,12 +60,30 @@ export declare class BotGenerator { * @returns IBotBase object */ protected getCloneOfBotBase(): IBotBase; - protected generateBot(bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + /** + * Create a IBotBase object with equipment/loot/exp etc + * @param sessionId Session id + * @param bot bots base file + * @param role botRole bot will use + * @param node Bot template from db/bots/x.json + * @param isPmc Is bot to be a PMC + * @param isPlayerScav is bot to be a p scav bot + * @returns IBotBase object + */ + protected generateBot(sessionId: string, bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; /** * Log the number of PMCs generated to the debug console + * @param output Generated bot array, ready to send to client */ protected logPmcGeneratedCount(output: IBotBase[]): void; - protected generateRandomLevel(min: number, max: number): BotGenerator.IRandomisedBotLevelResult; + /** + * Return a randomised bot level and exp value + * @param role botRole being generated for + * @param min Min exp value + * @param max Max exp value + * @returns IRandomisedBotLevelResult object + */ + protected generateRandomLevel(role: string, min: number, max: number): BotGenerator.IRandomisedBotLevelResult; /** * Converts health object to the required format * @param healthObj health object from bot json @@ -72,19 +92,23 @@ export declare class BotGenerator { */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; protected generateSkills(skillsObj: Skills): Skills; - /** - * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) - * @param pmcSide eft side (usec/bear) - * @returns pmc side as defined in config - */ - protected getPmcRole(pmcSide: string): string; /** * Iterate through bots inventory and loot to find and remove christmas items (as defined in GameEventHelper) * @param nodeInventory Bots inventory to iterate over */ protected removeChristmasItemsFromBotInventory(nodeInventory: Inventory): void; + /** + * Generate a random Id for a bot and apply to bots _id and aid value + * @param bot bot to update + * @returns updated IBotBase object + */ protected generateId(bot: IBotBase): IBotBase; protected generateInventoryID(profile: IBotBase): IBotBase; + /** + * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * @param requestedDifficulty + * @returns + */ protected getPMCDifficulty(requestedDifficulty: string): string; /** * Add a side-specific (usec/bear) dogtag item to a bots inventory diff --git a/Live/CWX_DebugTool/dist/types/generators/BotInventoryGenerator.d.ts b/Live/CWX_DebugTool/dist/types/generators/BotInventoryGenerator.d.ts index 35d1ee8..c5ed545 100644 --- a/Live/CWX_DebugTool/dist/types/generators/BotInventoryGenerator.d.ts +++ b/Live/CWX_DebugTool/dist/types/generators/BotInventoryGenerator.d.ts @@ -1,13 +1,16 @@ +import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Inventory, Chances, Generation, Mods } from "../models/eft/common/tables/IBotType"; +import { Chances, Generation, Inventory, Mods } from "../models/eft/common/tables/IBotType"; +import { EquipmentSlots } from "../models/enums/EquipmentSlots"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; -import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; -import { BotWeaponGenerator } from "./BotWeaponGenerator"; import { BotLootGenerator } from "./BotLootGenerator"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; +import { BotWeaponGenerator } from "./BotWeaponGenerator"; export declare class BotInventoryGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -17,8 +20,14 @@ export declare class BotInventoryGenerator { protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper); - generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { + slot: EquipmentSlots; + shouldSpawn: boolean; + }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; protected generateInventoryBase(): PmcInventory; } diff --git a/Live/CWX_DebugTool/dist/types/generators/BotLootGenerator.d.ts b/Live/CWX_DebugTool/dist/types/generators/BotLootGenerator.d.ts index c6a3f29..c1f5310 100644 --- a/Live/CWX_DebugTool/dist/types/generators/BotLootGenerator.d.ts +++ b/Live/CWX_DebugTool/dist/types/generators/BotLootGenerator.d.ts @@ -1,4 +1,5 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; @@ -20,11 +21,12 @@ export declare class BotLootGenerator { protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botLootCacheService: BotLootCacheService, configServer: ConfigServer); - generateLoot(templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer); + generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached @@ -47,7 +49,7 @@ export declare class BotLootGenerator { * @param botRole bots role, .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; /** * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from diff --git a/Live/CWX_DebugTool/dist/types/generators/BotWeaponGenerator.d.ts b/Live/CWX_DebugTool/dist/types/generators/BotWeaponGenerator.d.ts index 9215214..487901b 100644 --- a/Live/CWX_DebugTool/dist/types/generators/BotWeaponGenerator.d.ts +++ b/Live/CWX_DebugTool/dist/types/generators/BotWeaponGenerator.d.ts @@ -1,4 +1,5 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { MinMax } from "../models/common/MinMax"; @@ -14,6 +15,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { IInventoryMagGen } from "./weapongen/IInventoryMagGen"; export declare class BotWeaponGenerator { protected jsonUtil: JsonUtil; protected logger: ILogger; @@ -24,11 +26,24 @@ export declare class BotWeaponGenerator { protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; protected configServer: ConfigServer; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, inventoryMagGenComponents: IInventoryMagGen[]); /** - * Get a random weapon from a bots pool of weapons (weighted) + * Pick a random weapon based on weightings and generate a functional weapon + * @param equipmentSlot Primary/secondary/holster + * @param botTemplateInventory e.g. assault.json + * @param weaponParentId + * @param modChances + * @param botRole role of bot, e.g. assault/followerBully + * @param isPmc Is weapon generated for a pmc + * @returns GenerateWeaponResult object + */ + generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + /** + * Get a random weighted weapon from a bots pool of weapons * @param equipmentSlot Primary/secondary/holster * @param botTemplateInventory e.g. assault.json * @returns weapon tpl @@ -39,43 +54,24 @@ export declare class BotWeaponGenerator { * @param weaponTpl weapon tpl to generate (use pickWeightedWeaponTplFromPool()) * @param equipmentSlot slot to fit into, primary/secondary/holster * @param botTemplateInventory e.g. assault.json - * @param weaponParentId - * @param modChances - * @param botRole + * @param weaponParentId ParentId of the weapon being generated + * @param modChances Dictionary of item types and % chance weapon will have that mod + * @param botRole e.g. assault/exusec * @param isPmc * @returns GenerateWeaponResult object */ - generateWeaponByTpl(weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; /** - * Generate an entirely random weapon - * @param equipmentSlot Primary/secondary/holster - * @param botTemplateInventory e.g. assault.json - * @param weaponParentId - * @param modChances - * @param botRole - * @param isPmc - * @returns GenerateWeaponResult object - */ - generateRandomWeapon(equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; - /** - * Create array with weapon base as only element - * Add additional properties as required - * @param weaponTpl - * @param weaponParentId - * @param equipmentSlot - * @param weaponItemTemplate + * Create array with weapon base as only element and + * add additional properties based on weapon type + * @param weaponTpl Weapon tpl to create item with + * @param weaponParentId Weapons parent id + * @param equipmentSlot e.g. primary/secondary/holster + * @param weaponItemTemplate db template for weapon * @param botRole for durability values - * @returns + * @returns Base weapon item in array */ - constructWeaponBaseArray(weaponTpl: string, weaponParentId: string, equipmentSlot: string, weaponItemTemplate: ITemplateItem, botRole: string): Item[]; - /** - * Add compatible magazines to an inventory based on a generated weapon - * @param weaponDetails - * @param magCounts - * @param inventory - * @param botRole the bot type we're getting generating extra mags for - */ - addExtraMagazinesToInventory(weaponDetails: GenerateWeaponResult, magCounts: MinMax, inventory: PmcInventory, botRole: string): void; + protected constructWeaponBaseArray(weaponTpl: string, weaponParentId: string, equipmentSlot: string, weaponItemTemplate: ITemplateItem, botRole: string): Item[]; /** * Get the mods necessary to kit out a weapon to its preset level * @param weaponTpl weapon to find preset for @@ -84,33 +80,21 @@ export declare class BotWeaponGenerator { * @returns array of weapon mods */ protected getPresetWeaponMods(weaponTpl: string, equipmentSlot: string, weaponParentId: string, itemTemplate: ITemplateItem, botRole: string): Item[]; - /** Checks if all required slots are occupied on a weapon and all it's mods */ + /** + * Checks if all required slots are occupied on a weapon and all it's mods + * @param weaponItemArray Weapon + mods + * @returns true if valid + */ protected isWeaponValid(weaponItemArray: Item[]): boolean; /** * Generates extra magazines or bullets (if magazine is internal) and adds them to TacticalVest and Pockets. * Additionally, adds extra bullets to SecuredContainer - * @param weaponMods - * @param weaponTemplate - * @param magCounts - * @param ammoTpl - * @param inventory - * @param botRole the bot type we're getting generating extra mags for - * @returns + * @param generatedWeaponResult object with properties for generated weapon (weapon mods pool / weapon template / ammo tpl) + * @param magCounts Magazine count to add to inventory + * @param inventory Inventory to add magazines to + * @param botRole The bot type we're getting generating extra mags for */ - protected generateExtraMagazines(weaponMods: Item[], weaponTemplate: ITemplateItem, magCounts: MinMax, ammoTpl: string, inventory: PmcInventory, botRole: string): void; - /** - * Get a randomised number of bullets for a specific magazine - * @param magCounts min and max count of magazines - * @param magTemplate magazine to generate bullet count for - * @returns bullet count number - */ - protected getRandomisedBulletCount(magCounts: MinMax, magTemplate: ITemplateItem): number; - /** - * Get a randomised count of magazines - * @param magCounts min and max value returned value can be between - * @returns numberical value of magazine count - */ - protected getRandomisedMagazineCount(magCounts: MinMax): number; + addExtraMagazinesToInventory(generatedWeaponResult: GenerateWeaponResult, magCounts: MinMax, inventory: PmcInventory, botRole: string): void; /** * Add ammo to the secure container * @param stackCount How many stacks of ammo to add @@ -127,21 +111,13 @@ export declare class BotWeaponGenerator { * @returns magazine tpl string */ protected getMagazineTplFromWeaponTemplate(weaponMods: Item[], weaponTemplate: ITemplateItem, botRole: string): string; - /** - * Get a weapons default magazine template id - * @param weaponTemplate weapon to get default magazine for - * @returns tpl of magazine - */ - protected getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - protected addBulletsToVestAndPockets(ammoTpl: string, bulletCount: number, inventory: PmcInventory): void; /** * Finds and return a compatible ammo tpl based on the bots ammo weightings (x.json/inventory/equipment/ammo) * @param ammo a list of ammo tpls the weapon can use * @param weaponTemplate the weapon we want to pick ammo for - * @param isPmc is the ammo being gathered for a pmc (runs pmc ammo filtering) * @returns an ammo tpl that works with the desired gun */ - protected getCompatibleAmmo(ammo: Record>, weaponTemplate: ITemplateItem, isPmc: boolean): string; + protected getWeightedCompatibleAmmo(ammo: Record>, weaponTemplate: ITemplateItem): string; /** * Get a weapons compatible cartridge caliber * @param weaponTemplate Weapon to look up caliber of diff --git a/Live/CWX_DebugTool/dist/types/generators/LocationGenerator.d.ts b/Live/CWX_DebugTool/dist/types/generators/LocationGenerator.d.ts index bd368b5..cc61dcf 100644 --- a/Live/CWX_DebugTool/dist/types/generators/LocationGenerator.d.ts +++ b/Live/CWX_DebugTool/dist/types/generators/LocationGenerator.d.ts @@ -3,10 +3,9 @@ import { GameEventHelper } from "../helpers/GameEventHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; -import { ILooseLoot, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; +import { ILooseLoot, SpawnpointsForced, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; import { Item } from "../models/eft/common/tables/IItem"; import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticLootDetails } from "../models/eft/common/tables/ILootBase"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -36,11 +35,19 @@ export declare class LocationGenerator { generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; + /** + * Create array of loose + forced loot using probability system + * @param dynamicLootDist + * @param staticAmmoDist + * @param locationName Location to generate loot for + * @returns Array of spawn points with loot in them + */ generateDynamicLoot(dynamicLootDist: ILooseLoot, staticAmmoDist: Record, locationName: string): SpawnpointTemplate[]; + /** + * Add forced spawn point loot into loot parameter array + * @param loot array to add forced loot to + * @param forcedSpawnPoints forced loot to add + */ + protected addForcedLoot(loot: SpawnpointTemplate[], forcedSpawnPoints: SpawnpointsForced[]): void; protected createItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; - protected getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; - protected getRandomValidCaliber(magTemplate: ITemplateItem): string; - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; - protected createRandomMagCartridges(magTemplate: ITemplateItem, parentId: string, staticAmmoDist: Record, caliber?: string): Item; - protected createCartidges(parentId: string, ammoTpl: string, stackCount: number): Item; } diff --git a/Live/CWX_DebugTool/dist/types/generators/LootGenerator.d.ts b/Live/CWX_DebugTool/dist/types/generators/LootGenerator.d.ts new file mode 100644 index 0000000..bbc1915 --- /dev/null +++ b/Live/CWX_DebugTool/dist/types/generators/LootGenerator.d.ts @@ -0,0 +1,58 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Preset } from "../models/eft/common/IGlobals"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { LootItem } from "../models/spt/services/LootItem"; +import { LootRequest } from "../models/spt/services/LootRequest"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { HashUtil } from "../utils/HashUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class LootGenerator { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected databaseServer: DatabaseServer; + protected randomUtil: RandomUtil; + protected itemHelper: ItemHelper; + protected itemFilterService: ItemFilterService; + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, itemFilterService: ItemFilterService); + /** + * Generate a list of items based on options passed in + * @param options parameters to adjust what loot is generated + * @returns An array of loot items + */ + createRandomloot(options: LootRequest): LootItem[]; + /** + * Construct item limit record to hold max and current item count + * @param limits limits as defined in config + * @returns record, key: item tplId, value: current/max item count allowed + */ + protected initItemLimitCounter(limits: Record): Record; + /** + * Find a random item in items.json and add to result array + * @param items items to choose from + * @param itemTypeCounts item limit counts + * @param options item filters + * @param result array to add found item to + * @returns true if item was valid and added to pool + */ + protected findAndAddRandomItemToLoot(items: [string, ITemplateItem][], itemTypeCounts: Record, options: LootRequest, result: LootItem[]): boolean; + /** + * + * Find a random item in items.json and add to result array + * @param globalDefaultPresets presets to choose from + * @param itemTypeCounts item limit counts + * @param result array to add found preset to + * @returns true if preset was valid and added to pool + */ + protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, Preset][], itemTypeCounts: Record, result: LootItem[]): boolean; +} diff --git a/Live/CWX_DebugTool/dist/types/generators/PMCLootGenerator.d.ts b/Live/CWX_DebugTool/dist/types/generators/PMCLootGenerator.d.ts index 64e6f7f..b9f2a83 100644 --- a/Live/CWX_DebugTool/dist/types/generators/PMCLootGenerator.d.ts +++ b/Live/CWX_DebugTool/dist/types/generators/PMCLootGenerator.d.ts @@ -1,15 +1,21 @@ import { ItemHelper } from "../helpers/ItemHelper"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ConfigServer } from "../servers/ConfigServer"; import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +/** + * Handle the generation of dynamic PMC loot in pockets and backpacks + * and the removal of blacklisted items + */ export declare class PMCLootGenerator { protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; + protected itemFilterService: ItemFilterService; protected pocketLootPool: string[]; protected backpackLootPool: string[]; protected botConfig: IBotConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService); generatePMCPocketLootPool(): string[]; generatePMCBackpackLootPool(): string[]; } diff --git a/Live/CWX_DebugTool/dist/types/generators/RagfairAssortGenerator.d.ts b/Live/CWX_DebugTool/dist/types/generators/RagfairAssortGenerator.d.ts index cbdd7f2..db4811d 100644 --- a/Live/CWX_DebugTool/dist/types/generators/RagfairAssortGenerator.d.ts +++ b/Live/CWX_DebugTool/dist/types/generators/RagfairAssortGenerator.d.ts @@ -1,5 +1,8 @@ import { ItemHelper } from "../helpers/ItemHelper"; +import { Preset } from "../models/eft/common/IGlobals"; import { Item } from "../models/eft/common/tables/IItem"; +import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -8,18 +11,40 @@ export declare class RagfairAssortGenerator { protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; protected generatedAssortItems: Item[]; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer); + protected ragfairConfig: IRagfairConfig; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); /** * Get an array of unique items that can be sold on the flea * @returns array of unique items */ getAssortItems(): Item[]; + /** + * Check internal generatedAssortItems array has objects + * @returns true if array has objects + */ protected assortsAreGenerated(): boolean; /** * Generate an array of items the flea can sell * @returns array of unique items */ protected generateRagfairAssortItems(): Item[]; + /** + * Get presets from globals.json + * @returns Preset object array + */ + protected getPresets(): Preset[]; + /** + * Get default presets from globals.json + * @returns Preset object array + */ + protected getDefaultPresets(): Preset[]; + /** + * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true + * @param tplId tplid to add to item + * @param id id to add to item + * @returns hydrated Item object + */ protected createRagfairAssortItem(tplId: string, id?: string): Item; } diff --git a/Live/CWX_DebugTool/dist/types/generators/ScavCaseRewardGenerator.d.ts b/Live/CWX_DebugTool/dist/types/generators/ScavCaseRewardGenerator.d.ts index c7d6ab7..89cb5c8 100644 --- a/Live/CWX_DebugTool/dist/types/generators/ScavCaseRewardGenerator.d.ts +++ b/Live/CWX_DebugTool/dist/types/generators/ScavCaseRewardGenerator.d.ts @@ -8,9 +8,13 @@ import { RewardCountAndPriceDetails, ScavCaseRewardCountsAndPrices } from "../mo import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { RagfairPriceService } from "../services/RagfairPriceService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +/** + * Handle the creation of randomised scav case rewards + */ export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; @@ -18,9 +22,10 @@ export declare class ScavCaseRewardGenerator { protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param body client request diff --git a/Live/CWX_DebugTool/dist/types/generators/WeatherGenerator.d.ts b/Live/CWX_DebugTool/dist/types/generators/WeatherGenerator.d.ts index 44cecbb..8ddbe49 100644 --- a/Live/CWX_DebugTool/dist/types/generators/WeatherGenerator.d.ts +++ b/Live/CWX_DebugTool/dist/types/generators/WeatherGenerator.d.ts @@ -1,7 +1,7 @@ import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { ConfigServer } from "../servers/ConfigServer"; import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class WeatherGenerator { @@ -21,11 +21,16 @@ export declare class WeatherGenerator { protected getAcceleratedTime(computedDate: Date): string; /** * Get current time formatted to fit BSGs requirement - * @param computedDate + * @param computedDate date to format into bsg style * @returns */ protected getNormalTime(computedDate: Date): string; - generateWeather(data: IWeatherData): IWeatherData; + /** + * Return randomised Weather data + * @param weatherData weather input data + * @returns Randomised weather data + */ + generateWeather(weatherData: IWeatherData): IWeatherData; protected getWeightedFog(): string; protected getWeightedRain(): number; protected getRandomFloat(node: string): number; diff --git a/Live/CWX_DebugTool/dist/types/generators/weapongen/IInventoryMagGen.d.ts b/Live/CWX_DebugTool/dist/types/generators/weapongen/IInventoryMagGen.d.ts new file mode 100644 index 0000000..792f510 --- /dev/null +++ b/Live/CWX_DebugTool/dist/types/generators/weapongen/IInventoryMagGen.d.ts @@ -0,0 +1,6 @@ +import { InventoryMagGen } from "./InventoryMagGen"; +export interface IInventoryMagGen { + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_DebugTool/dist/types/generators/weapongen/InventoryMagGen.d.ts b/Live/CWX_DebugTool/dist/types/generators/weapongen/InventoryMagGen.d.ts new file mode 100644 index 0000000..30bf79f --- /dev/null +++ b/Live/CWX_DebugTool/dist/types/generators/weapongen/InventoryMagGen.d.ts @@ -0,0 +1,16 @@ +import { MinMax } from "../../models/common/MinMax"; +import { Inventory } from "../../models/eft/common/tables/IBotBase"; +import { ITemplateItem } from "../../models/eft/common/tables/ITemplateItem"; +export declare class InventoryMagGen { + private magCounts; + private magazineTemplate; + private weaponTemplate; + private ammoTemplate; + private pmcInventory; + constructor(magCounts: MinMax, magazineTemplate: ITemplateItem, weaponTemplate: ITemplateItem, ammoTemplate: ITemplateItem, pmcInventory: Inventory); + getMagCount(): MinMax; + getMagazineTemplate(): ITemplateItem; + getWeaponTemplate(): ITemplateItem; + getAmmoTemplate(): ITemplateItem; + getPmcInventory(): Inventory; +} diff --git a/Live/CWX_DebugTool/dist/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts b/Live/CWX_DebugTool/dist/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts new file mode 100644 index 0000000..b754d5f --- /dev/null +++ b/Live/CWX_DebugTool/dist/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts @@ -0,0 +1,12 @@ +import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; +import { RandomUtil } from "../../../utils/RandomUtil"; +import { IInventoryMagGen } from "../IInventoryMagGen"; +import { InventoryMagGen } from "../InventoryMagGen"; +export declare class BarrelInventoryMagGen implements IInventoryMagGen { + protected randomUtil: RandomUtil; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + constructor(randomUtil: RandomUtil, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_DebugTool/dist/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/Live/CWX_DebugTool/dist/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts new file mode 100644 index 0000000..4fcb1e2 --- /dev/null +++ b/Live/CWX_DebugTool/dist/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -0,0 +1,14 @@ +import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; +import { ItemHelper } from "../../../helpers/ItemHelper"; +import { ILogger } from "../../../models/spt/utils/ILogger"; +import { IInventoryMagGen } from "../IInventoryMagGen"; +import { InventoryMagGen } from "../InventoryMagGen"; +export declare class ExternalInventoryMagGen implements IInventoryMagGen { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + constructor(logger: ILogger, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_DebugTool/dist/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts b/Live/CWX_DebugTool/dist/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts new file mode 100644 index 0000000..4548a04 --- /dev/null +++ b/Live/CWX_DebugTool/dist/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts @@ -0,0 +1,10 @@ +import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; +import { IInventoryMagGen } from "../IInventoryMagGen"; +import { InventoryMagGen } from "../InventoryMagGen"; +export declare class InternalMagazineInventoryMagGen implements IInventoryMagGen { + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + constructor(botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_DebugTool/dist/types/helpers/AssortHelper.d.ts b/Live/CWX_DebugTool/dist/types/helpers/AssortHelper.d.ts index 15586b9..bfc157f 100644 --- a/Live/CWX_DebugTool/dist/types/helpers/AssortHelper.d.ts +++ b/Live/CWX_DebugTool/dist/types/helpers/AssortHelper.d.ts @@ -17,7 +17,7 @@ export declare class AssortHelper { * @param assort assort items from a trader * @returns assort items minus locked quest assorts */ - stripLockedQuestAssort(pmcProfile: IPmcData, traderId: string, assort: ITraderAssort): ITraderAssort; + stripLockedQuestAssort(pmcProfile: IPmcData, traderId: string, assort: ITraderAssort, flea?: boolean): ITraderAssort; /** * Remove assorts from a trader that have not been unlocked yet * @param pmcProfile player profile @@ -32,5 +32,5 @@ export declare class AssortHelper { * @param itemID item id to remove from asort * @returns Modified assort */ - removeItemFromAssort(assort: ITraderAssort, itemID: string): ITraderAssort; + removeItemFromAssort(assort: ITraderAssort, itemID: string, flea?: boolean): ITraderAssort; } diff --git a/Live/CWX_DebugTool/dist/types/helpers/BotGeneratorHelper.d.ts b/Live/CWX_DebugTool/dist/types/helpers/BotGeneratorHelper.d.ts index 3cd7256..5e3e501 100644 --- a/Live/CWX_DebugTool/dist/types/helpers/BotGeneratorHelper.d.ts +++ b/Live/CWX_DebugTool/dist/types/helpers/BotGeneratorHelper.d.ts @@ -1,19 +1,33 @@ import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper"; -import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem"; -import { Grid, ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { ItemFilterService } from "../services/ItemFilterService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotWeaponGeneratorHelper } from "./BotWeaponGeneratorHelper"; import { ContainerHelper } from "./ContainerHelper"; import { InventoryHelper } from "./InventoryHelper"; import { ItemHelper } from "./ItemHelper"; import { ProbabilityHelper } from "./ProbabilityHelper"; +import { ProfileHelper } from "./ProfileHelper"; +export declare class BotModLimits { + scope: ItemCount; + scopeMax: number; + scopeBaseTypes: string[]; + flashlightLaser: ItemCount; + flashlightLaserMax: number; + flashlgihtLaserBaseTypes: string[]; +} +export declare class ItemCount { + count: number; +} export declare class BotGeneratorHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -25,16 +39,121 @@ export declare class BotGeneratorHelper { protected itemHelper: ItemHelper; protected inventoryHelper: InventoryHelper; protected containerHelper: ContainerHelper; + protected botEquipmentFilterService: BotEquipmentFilterService; + protected itemFilterService: ItemFilterService; + protected profileHelper: ProfileHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, configServer: ConfigServer); - generateModsForItem(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, configServer: ConfigServer); /** - * Is this magazine cylinder related (revolvers and grenade launchers) - * @param magazineParentName the name of the magazines parent - * @returns true if it is cylinder related + * Check mods are compatible and add to array + * @param equipment Equipment item to add mods to + * @param modPool Mod list to choose frm + * @param parentId parentid of item to add mod to + * @param parentTemplate template objet of item to add mods to + * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @returns Item + compatible mods as an array */ - magazineIsCylinderRelated(magazineParentName: string): boolean; + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + /** + * @param sessionId session id + * @param weapon Weapon to add mods to + * @param modPool Pool of compatible mods to attach to weapon + * @param weaponParentId parentId of weapon + * @param parentWeaponTemplate Weapon which mods will be generated on + * @param modSpawnChances Mod spawn chances + * @param ammoTpl Ammo tpl to use when generating magazines/cartridges + * @param botRole Role of bot weapon is generated for + * @returns Weapon + mods array + */ + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; + /** + * + * @param modSlot + * @param isRandomisableSlot + * @param modsParent + * @param botEquipBlacklist + * @param itemModPool + * @param weapon array with only weapon tpl in it, ready for mods to be added + * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) + * @param parentTemplate + * @returns + */ + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + /** + * Find mod tpls of a provided type and add to modPool + * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) + * @param modTemplate db object for modItem we get compatible mods from + * @param modPool Pool of mods we are adding to + */ + protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; + /** + * Check if mod item is on limited list + has surpassed the limit set for it + * @param botRole role the bot has e.g. assault + * @param modTemplate mods template data + * @param modLimits limits set for weapon being generated for this bot + * @returns true if over item limit + */ + protected modHasReachedItemLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits): boolean; + /** + * Initalise mod limits to be used when generating a weapon + * @param botRole "assault", "bossTagilla" or "pmc" + * @returns BotModLimits object + */ + protected initModLimits(botRole: string): BotModLimits; + /** + * Generate a pool of mods for this bots mod type if bot has values inside `randomisedWeaponModSlots` array found in bot.json/equipment[botrole] + * @param allowedMods Mods to be added to mod pool + * @param botEquipBlacklist blacklist of items not allowed to be added to mod pool + * @param modSlot Slot to generate mods for + * @param itemModPool base mod pool to replace values of + */ + protected generateDynamicWeaponModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record): void; + /** + * Find all compatible mods for equipment item and add to modPool + * @param itemDetails item to find mods for + * @param modPool ModPool to add mods to + */ + generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods): void; + /** + * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist + * @param allowedMods base mods to filter + * @param botEquipBlacklist equipment blacklist + * @param modSlot slot mods belong to + * @returns Filtered array of mod tpls + */ + protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; + /** + * Check if the specific item type on the weapon has reached the set limit + * @param modTpl log mod tpl if over type limit + * @param currentCount current number of this item on gun + * @param maxLimit mod limit allowed + * @param botRole role of bot we're checking weapon of + * @returns true if limit reached + */ + protected weaponModLimitReached(modTpl: string, currentCount: { + count: number; + }, maxLimit: number, botRole: string): boolean; + /** + * Log errors if mod is not compatible with slot + * @param modToAdd template of mod to check + * @param itemSlot slot the item will be placed in + * @param modSlot slot the mod will fill + * @param parentTemplate tempalte of the mods parent item + * @returns true if valid + */ + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + /** + * Create a mod item with parameters as properties + * @param modId _id + * @param modTpl _tpl + * @param parentId parentId + * @param modSlot slotId + * @param modTemplate Used to add additional properites in the upd object + * @returns Item object + */ + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem): Item; /** * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance @@ -46,7 +165,7 @@ export declare class BotGeneratorHelper { protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; /** * Get a list of containers that hold ammo - * e.g. mod_magazine + * e.g. mod_magazine / patron_in_weapon_000 * @returns string array */ protected getAmmoContainers(): string[]; @@ -62,11 +181,11 @@ export declare class BotGeneratorHelper { * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" - * - * @param {object} items The items where the CylinderMagazine's camora are appended to - * @param {object} modPool modPool which should include available cartrigdes - * @param {string} parentId The CylinderMagazine's UID - * @param {object} parentTemplate The CylinderMagazine's template + * @param items The items where the CylinderMagazine's camora are appended to + * @param modPool modPool which should include available cartrigdes + * @param parentId The CylinderMagazine's UID + * @param parentTemplate The CylinderMagazine's template + * @returns */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** @@ -75,6 +194,13 @@ export declare class BotGeneratorHelper { * @returns string array of shells fro luitple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + /** + * Adds properties to an item + * e.g. Repairable / HasHinge / Foldable / MaxDurability + * @param itemTemplate + * @param botRole Used by weapons to randomise the durability values + * @returns Item Upd object with extra properties + */ generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { upd?: Upd; }; @@ -92,13 +218,15 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; - protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** - * Sort by spawn chance, highest to lowest, higher is more common - * @param unsortedModArray String array to sort - * @returns Sorted string array + * Get a random mod from an items compatible mods Filter array + * @param modTpl + * @param parentSlot + * @param modSlot + * @param items + * @returns item tpl */ - protected sortModArray(unsortedModArray: string[]): string[]; + protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** * Can an item be added to an item without issue * @param items @@ -107,18 +235,8 @@ export declare class BotGeneratorHelper { * @returns true if possible */ isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; - /** - * Adds an item with all its childern into specified equipmentSlots, wherever it fits. - * @param equipmentSlots - * @param parentId - * @param parentTpl - * @param itemWithChildren - * @param inventory - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: PmcInventory): boolean; - protected itemAllowedInContainer(slot: Grid, itemTpl: string): boolean; } +/** TODO - move into own class */ export declare class ExhaustableArray { private itemPool; private randomUtil; diff --git a/Live/CWX_DebugTool/dist/types/helpers/BotHelper.d.ts b/Live/CWX_DebugTool/dist/types/helpers/BotHelper.d.ts index 9b89481..18738e5 100644 --- a/Live/CWX_DebugTool/dist/types/helpers/BotHelper.d.ts +++ b/Live/CWX_DebugTool/dist/types/helpers/BotHelper.d.ts @@ -13,11 +13,34 @@ export declare class BotHelper { protected configServer: ConfigServer; protected botConfig: IBotConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, configServer: ConfigServer); + /** + * Get difficulty settings for desired bot type, if not found use assault bot types + * @param type bot type to retreive difficulty of + * @param difficulty difficulty to get settings for (easy/normal etc) + * @returns Difficulty object + */ getBotDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Get a template object for the specified botRole from bots.types db + * @param role botRole to get template for + * @returns IBotType object + */ getBotTemplate(role: string): IBotType; + /** + * Get difficulty settings for a PMC + * @param type "usec" / "bear" + * @param difficulty what difficulty to retrieve + * @returns Difficulty object + */ getPmcDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Choose a random difficulty from - easy/normal/hard/impossible + * @returns random difficulty + */ + chooseRandomDifficulty(): string; /** * Randomise the chance the PMC will attack their own side + * Look up value in bot.json/chanceSameSideIsHostilePercent * @param difficultySettings pmc difficulty settings */ randomisePmcHostility(difficultySettings: Difficulty): void; @@ -31,7 +54,7 @@ export declare class BotHelper { */ addBotToFriendlyList(difficultySettings: Difficulty, typeToAdd: string): void; /** - * Add a bot to the ENEMY_BOT_TYPES array + * Add a bot to the ENEMY_BOT_TYPES array, do not add itself if its on the enemy list * @param difficultySettings bot settings to alter * @param typesToAdd bot type to add to enemy list */ @@ -42,4 +65,10 @@ export declare class BotHelper { * @param typesToAdd bot type to add to revenge list */ addBotToRevengeList(difficultySettings: Difficulty, typesToAdd: string[]): void; + /** + * Choose if a bot should become a PMC by checking if bot type is allowed to become a Pmc in botConfig.convertFromChances and doing a random int check + * @param botRole the bot role to check if should be a pmc + * @returns true if should be a pmc + */ + shouldBotBePmc(botRole: string): boolean; } diff --git a/Live/CWX_DebugTool/dist/types/helpers/BotWeaponGeneratorHelper.d.ts b/Live/CWX_DebugTool/dist/types/helpers/BotWeaponGeneratorHelper.d.ts new file mode 100644 index 0000000..7e25f56 --- /dev/null +++ b/Live/CWX_DebugTool/dist/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -0,0 +1,78 @@ +import { MinMax } from "../models/common/MinMax"; +import { Inventory } from "../models/eft/common/tables/IBotBase"; +import { Item } from "../models/eft/common/tables/IItem"; +import { Grid, ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { HashUtil } from "../utils/HashUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { ContainerHelper } from "./ContainerHelper"; +import { InventoryHelper } from "./InventoryHelper"; +import { ItemHelper } from "./ItemHelper"; +export declare class BotWeaponGeneratorHelper { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper); + /** + * Get a randomised number of bullets for a specific magazine + * @param magCounts min and max count of magazines + * @param magTemplate magazine to generate bullet count for + * @returns bullet count number + */ + getRandomisedBulletCount(magCounts: MinMax, magTemplate: ITemplateItem): number; + /** + * Get a randomised count of magazines + * @param magCounts min and max value returned value can be between + * @returns numberical value of magazine count + */ + getRandomisedMagazineCount(magCounts: MinMax): number; + /** + * Is this magazine cylinder related (revolvers and grenade launchers) + * @param magazineParentName the name of the magazines parent + * @returns true if it is cylinder related + */ + magazineIsCylinderRelated(magazineParentName: string): boolean; + /** + * Create a magazine using the parameters given + * @param magazineTpl Tpl of the magazine to create + * @param ammoTpl Ammo to add to magazine + * @param magTemplate template object of magazine + * @returns Item array + */ + createMagazine(magazineTpl: string, ammoTpl: string, magTemplate: ITemplateItem): Item[]; + /** + * Add a specific number of cartrdiges to a bots inventory (vest/pocket) + * @param ammoTpl Ammo tpl to add to vest/pockets + * @param cartridgeCount number of cartridges to add to vest/pockets + * @param inventory bot inventory to add cartridges to + */ + addBulletsToVestAndPockets(ammoTpl: string, cartridgeCount: number, inventory: Inventory): void; + /** + * Get a weapons default magazine template id + * @param weaponTemplate weapon to get default magazine for + * @returns tpl of magazine + */ + getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; + /** + * Adds an item with all its childern into specified equipmentSlots, wherever it fits. + * @param equipmentSlots + * @param parentId + * @param parentTpl + * @param itemWithChildren + * @param inventory + * @returns a `boolean` indicating item was added + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): boolean; + /** + * is the provided item allowed inside a container + * @param slot location item wants to be placed in + * @param itemTpl item being placed + * @returns true if allowed + */ + protected itemAllowedInContainer(slot: Grid, itemTpl: string): boolean; +} diff --git a/Live/CWX_DebugTool/dist/types/helpers/HideoutHelper.d.ts b/Live/CWX_DebugTool/dist/types/helpers/HideoutHelper.d.ts index 36e4009..7495a6a 100644 --- a/Live/CWX_DebugTool/dist/types/helpers/HideoutHelper.d.ts +++ b/Live/CWX_DebugTool/dist/types/helpers/HideoutHelper.d.ts @@ -44,14 +44,72 @@ export declare class HideoutHelper { initProduction(recipeId: string, productionTime: number): Production; isProductionType(productive: Productive): productive is Production; applyPlayerUpgradesBonuses(pmcData: IPmcData, bonus: StageBonus): void; + /** + * TODO: + * After looking at the skills there doesnt seem to be a configuration per skill to boost + * the XP gain PER skill. I THINK you should be able to put the variable "SkillProgress" (just like health has it) + * and be able to tune the skill gain PER skill, but I havent tested it and Im not sure! + * @param pmcData + * @param bonus + */ protected applySkillXPBoost(pmcData: IPmcData, bonus: StageBonus): void; + /** + * Process a players hideout, update areas that use resources + increment production timers + * @param sessionID Session id + */ updatePlayerHideout(sessionID: string): void; + /** + * Update progress timer for water collector + * @param pmcData profile to update + * @param productionId id of water collection production to update + * @param hideoutProperties Hideout properties + */ + protected updateWaterCollectorProductionTimer(pmcData: IPmcData, productionId: string, hideoutProperties: { + btcFarmCGs?: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Update progress timer for scav case + * @param pmcData Profile to update + * @param productionId Id of scav case production to update + */ + protected updateScavCaseProductionTimer(pmcData: IPmcData, productionId: string): void; + /** + * Iterate over hideout areas that use resources (fuel/filters etc) and update associated values + * @param sessionID Session id + * @param pmcData Profile to update areas of + * @param hideoutProperties hideout properties + */ + protected updateAreasWithResources(sessionID: string, pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): HideoutArea; - protected updateWaterFilters(waterFilterArea: HideoutArea, pwProd: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; + /** + * Adjust water filter objects resourceValue or delete when they reach 0 resource + * @param waterFilterArea water filter area to update + * @param production production object + * @param isGeneratorOn is generatory enabled + * @param pmcData Player profile + * @returns Updated HideoutArea object + */ + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): HideoutArea; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; protected getBTCSlots(pmcData: IPmcData): number; protected getManagementSkillsSlots(): number; diff --git a/Live/CWX_DebugTool/dist/types/helpers/InRaidHelper.d.ts b/Live/CWX_DebugTool/dist/types/helpers/InRaidHelper.d.ts index b382e30..962df38 100644 --- a/Live/CWX_DebugTool/dist/types/helpers/InRaidHelper.d.ts +++ b/Live/CWX_DebugTool/dist/types/helpers/InRaidHelper.d.ts @@ -18,18 +18,6 @@ export declare class InRaidHelper { protected paymentHelper: PaymentHelper; protected profileFixerService: ProfileFixerService; constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); - /** - * Reset the SPT inraid property stored in a profile to 'none' - * @param sessionID Session id - */ - protected removePlayer(sessionID: string): void; - /** - * Some maps have one-time-use keys (e.g. Labs - * Remove the relevant key from an inventory based on the post-raid request data passed in - * @param offraidData post-raid data - * @param sessionID Session id - */ - protected removeMapAccessKey(offraidData: ISaveProgressRequestData, sessionID: string): void; /** * Check an array of items and add an upd object to money items with a stack count of 1 * Single stack money items have no upd object and thus no StackObjectsCount, causing issues @@ -54,6 +42,18 @@ export declare class InRaidHelper { * @returns Reset profile object */ updateProfileBaseStats(profileData: IPmcData, saveProgressRequest: ISaveProgressRequestData, sessionID: string): IPmcData; + /** + * Some maps have one-time-use keys (e.g. Labs + * Remove the relevant key from an inventory based on the post-raid request data passed in + * @param offraidData post-raid data + * @param sessionID Session id + */ + protected removeMapAccessKey(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Set the SPT inraid location Profile property to 'none' + * @param sessionID Session id + */ + protected setPlayerInRaidLocationStatusToNone(sessionID: string): void; /** * Adds SpawnedInSession property to items found in a raid * Removes SpawnedInSession for non-scav players if item was taken into raid with SpawnedInSession = true @@ -95,5 +95,10 @@ export declare class InRaidHelper { * @returns true if item is kept after death */ isItemKeptAfterDeath(slotId: string): boolean; + /** + * Return the equipped items from a players inventory + * @param items Players inventory to search through + * @returns an array of equipped items + */ getPlayerGear(items: Item[]): Item[]; } diff --git a/Live/CWX_DebugTool/dist/types/helpers/ItemHelper.d.ts b/Live/CWX_DebugTool/dist/types/helpers/ItemHelper.d.ts index 1701c62..0effaf2 100644 --- a/Live/CWX_DebugTool/dist/types/helpers/ItemHelper.d.ts +++ b/Live/CWX_DebugTool/dist/types/helpers/ItemHelper.d.ts @@ -1,35 +1,30 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { InsuredItem } from "../models/eft/common/tables/IBotBase"; import { Item, Repairable } from "../models/eft/common/tables/IItem"; +import { IStaticAmmoDetails } from "../models/eft/common/tables/ILootBase"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ObjectId } from "../utils/ObjectId"; +import { RandomUtil } from "../utils/RandomUtil"; declare class ItemHelper { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected randomUtil: RandomUtil; + protected objectId: ObjectId; + protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer); /** - * Checks if a id is a valid item. Valid meaning that it's an item that be stored in stash + * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl * @returns boolean; true for items that may be in player posession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {*} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - isValidRewardItem(tpl: string): boolean; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - getRewardableItems(): [string, ITemplateItem][]; /** * Check if the tpl / template Id provided is a descendent of the baseclass * @@ -84,6 +79,11 @@ declare class ItemHelper { * @returns {array} The array of StackSlotItems */ generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; + /** + * Get cloned copy of all item data from items.json + * @returns array of ITemplateItem objects + */ + getItems(): ITemplateItem[]; /** * Gets item data from items.json * @param tpl items template id to look up @@ -196,6 +196,22 @@ declare class ItemHelper { * @returns ItemSize object (width and height) */ getItemSize(items: Item[], rootItemId: string): ItemHelper.ItemSize; + /** + * Get a random cartridge from an items Filter property + * @param item + * @returns + */ + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + createRandomMagCartridges(magTemplate: ITemplateItem, parentId: string, staticAmmoDist: Record, caliber?: string): Item; + protected getRandomValidCaliber(magTemplate: ITemplateItem): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + createCartidges(parentId: string, ammoTpl: string, stackCount: number): Item; + /** + * Get the size of a stack, return 1 if no stack object count property found + * @param item Item to get stack size of + * @returns size of stack + */ + getItemStackSize(item: Item): number; } declare namespace ItemHelper { interface ItemSize { diff --git a/Live/CWX_DebugTool/dist/types/helpers/ProfileHelper.d.ts b/Live/CWX_DebugTool/dist/types/helpers/ProfileHelper.d.ts index 9d4ff98..9c6560a 100644 --- a/Live/CWX_DebugTool/dist/types/helpers/ProfileHelper.d.ts +++ b/Live/CWX_DebugTool/dist/types/helpers/ProfileHelper.d.ts @@ -24,6 +24,19 @@ export declare class ProfileHelper { constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; getCompleteProfile(sessionID: string): IPmcData[]; + /** + * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen + * Server saves the post-raid changes prior to the xp screen getting the profile, this results in the xp screen using + * the now updated profile values as a base, meaning it shows x2 xp gained + * Instead, clone the post-raid profile (so we dont alter its values), apply the pre-raid xp values to the cloned objects and return + * Delete snapshot of pre-raid profile prior to returning profile data + * @param sessionId Session id + * @param output pmc and scav profiles array + * @param pmcProfile post-raid pmc profile + * @param scavProfile post-raid scav profile + * @returns updated profile array + */ + protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; /** * Add experience to a PMC inside the players profile diff --git a/Live/CWX_DebugTool/dist/types/helpers/QuestHelper.d.ts b/Live/CWX_DebugTool/dist/types/helpers/QuestHelper.d.ts index 32e55ec..d66d150 100644 --- a/Live/CWX_DebugTool/dist/types/helpers/QuestHelper.d.ts +++ b/Live/CWX_DebugTool/dist/types/helpers/QuestHelper.d.ts @@ -36,11 +36,20 @@ export declare class QuestHelper { protected configServer: ConfigServer; protected questConfig: IQuestConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); - questStatus(pmcData: IPmcData, questID: string): QuestStatus; /** - * returns true is the condition is satisfied + * Get status of a quest by quest id + * @param pmcData Profile to search + * @param questID Quest id to look up + * @returns QuestStauts enum + */ + getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus; + /** + * returns true is the level condition is satisfied + * @param playerLevel Players level + * @param condition Quest condition + * @returns true if player level is greater than or equal to quest */ - evaluateLevel(pmcProfile: IPmcData, cond: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; /** * Increase skill points of a skill on player profile diff --git a/Live/CWX_DebugTool/dist/types/helpers/RagfairOfferHelper.d.ts b/Live/CWX_DebugTool/dist/types/helpers/RagfairOfferHelper.d.ts index 8d03bee..e9d72ca 100644 --- a/Live/CWX_DebugTool/dist/types/helpers/RagfairOfferHelper.d.ts +++ b/Live/CWX_DebugTool/dist/types/helpers/RagfairOfferHelper.d.ts @@ -22,12 +22,14 @@ import { ProfileHelper } from "./ProfileHelper"; import { RagfairHelper } from "./RagfairHelper"; import { RagfairServerHelper } from "./RagfairServerHelper"; import { RagfairSortHelper } from "./RagfairSortHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class RagfairOfferHelper { protected logger: ILogger; protected timeUtil: TimeUtil; protected hashUtil: HashUtil; protected itemEventRouter: ItemEventRouter; protected databaseServer: DatabaseServer; + protected traderHelper: TraderHelper; protected saveServer: SaveServer; protected dialogueHelper: DialogueHelper; protected itemHelper: ItemHelper; @@ -43,10 +45,10 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; - processOffers(sessionID: string): boolean; + processOffersOnProfile(sessionID: string): boolean; protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; diff --git a/Live/CWX_DebugTool/dist/types/helpers/RagfairSellHelper.d.ts b/Live/CWX_DebugTool/dist/types/helpers/RagfairSellHelper.d.ts index 6ec004a..91b8a20 100644 --- a/Live/CWX_DebugTool/dist/types/helpers/RagfairSellHelper.d.ts +++ b/Live/CWX_DebugTool/dist/types/helpers/RagfairSellHelper.d.ts @@ -11,6 +11,12 @@ export declare class RagfairSellHelper { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateSellChance(baseChance: number, offerPrice: number, requirementsPriceInRub: number): number; - rollForSale(sellChance: number, count: number): SellResult[]; + calculateSellChance(baseChancePercent: number, offerPriceRub: number, playerListedPriceRub: number): number; + /** + * Determine if the offer being listed will be sold + * @param sellChancePercent chance item will sell + * @param itemSellCount count of items to sell + * @returns Array of purchases of item(s) lsited + */ + rollForSale(sellChancePercent: number, itemSellCount: number): SellResult[]; } diff --git a/Live/CWX_DebugTool/dist/types/helpers/RagfairServerHelper.d.ts b/Live/CWX_DebugTool/dist/types/helpers/RagfairServerHelper.d.ts index e4939d1..a03cdda 100644 --- a/Live/CWX_DebugTool/dist/types/helpers/RagfairServerHelper.d.ts +++ b/Live/CWX_DebugTool/dist/types/helpers/RagfairServerHelper.d.ts @@ -6,6 +6,7 @@ import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -13,6 +14,9 @@ import { RandomUtil } from "../utils/RandomUtil"; import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { ProfileHelper } from "./ProfileHelper"; +/** + * Helper class for common ragfair server actions + */ export declare class RagfairServerHelper { protected randomUtil: RandomUtil; protected hashUtil: HashUtil; @@ -23,11 +27,12 @@ export declare class RagfairServerHelper { protected localeService: LocaleService; protected dialogueHelper: DialogueHelper; protected jsonUtil: JsonUtil; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; protected static goodsReturnedTemplate: string; - constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); + constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Is item valid / on blacklist / quest item * @param itemDetails diff --git a/Live/CWX_DebugTool/dist/types/helpers/RepairHelper.d.ts b/Live/CWX_DebugTool/dist/types/helpers/RepairHelper.d.ts index 9a3ab29..5b09320 100644 --- a/Live/CWX_DebugTool/dist/types/helpers/RepairHelper.d.ts +++ b/Live/CWX_DebugTool/dist/types/helpers/RepairHelper.d.ts @@ -14,8 +14,17 @@ export declare class RepairHelper { protected configServer: ConfigServer; protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); - updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit?: boolean, applyRandomDegradation?: boolean): Item; - protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number): number; - protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, armorMax: number): number; + /** + * + * @param itemToRepair item to update durability details + * @param itemToRepairDetails db details of item to repair + * @param isArmor Is item being repaired a piece of armor + * @param amountToRepair how many unit of durability to repair + * @param useRepairKit Is item being repaired with a repair kit + * @param applyMaxDurabilityDegradation should item have max durability reduced + */ + updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit: boolean, traderQualityMultipler: number, applyMaxDurabilityDegradation?: boolean): void; + protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number, traderQualityMultipler: number): number; + protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, weaponMax: number, traderQualityMultipler: number): number; isWeaponTemplate(tpl: string): boolean; } diff --git a/Live/CWX_DebugTool/dist/types/helpers/TradeHelper.d.ts b/Live/CWX_DebugTool/dist/types/helpers/TradeHelper.d.ts index 975062b..7ab9768 100644 --- a/Live/CWX_DebugTool/dist/types/helpers/TradeHelper.d.ts +++ b/Live/CWX_DebugTool/dist/types/helpers/TradeHelper.d.ts @@ -39,6 +39,12 @@ export declare class TradeHelper { * @returns */ sellItem(pmcData: IPmcData, body: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Increment the assorts buy count by number of items purchased + * Show error on screen if player attepts 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; protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/Live/CWX_DebugTool/dist/types/helpers/TraderAssortHelper.d.ts b/Live/CWX_DebugTool/dist/types/helpers/TraderAssortHelper.d.ts index 677dd66..025efd6 100644 --- a/Live/CWX_DebugTool/dist/types/helpers/TraderAssortHelper.d.ts +++ b/Live/CWX_DebugTool/dist/types/helpers/TraderAssortHelper.d.ts @@ -1,6 +1,5 @@ import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator"; import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; -import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; import { ITrader, ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; @@ -41,12 +40,7 @@ export declare class TraderAssortHelper { * @param traderId traders id * @returns a traders' assorts */ - getAssort(sessionId: string, traderId: string): ITraderAssort; - /** - * if the fence assorts have expired, re-generate them - * @param pmcProfile Players profile - */ - refreshFenceAssortIfExpired(pmcProfile: IPmcData): void; + getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; /** * Reset a traders assorts and move nextResupply value to future * Flag trader as needing a flea offer reset to be picked up by flea update() function diff --git a/Live/CWX_DebugTool/dist/types/helpers/TraderHelper.d.ts b/Live/CWX_DebugTool/dist/types/helpers/TraderHelper.d.ts index 6bda5cd..0dc93e8 100644 --- a/Live/CWX_DebugTool/dist/types/helpers/TraderHelper.d.ts +++ b/Live/CWX_DebugTool/dist/types/helpers/TraderHelper.d.ts @@ -65,7 +65,7 @@ export declare class TraderHelper { * @param item * @returns boolean */ - protected isWeaponAndBelowTraderBuyDurability(traderID: string, item: Item): boolean; + protected isWeaponBelowTraderBuyDurability(traderID: string, item: Item): boolean; /** * Get the price of an item and all of its attached children * Take into account bonuses/adjsutments e.g. discounts diff --git a/Live/CWX_DebugTool/dist/types/loaders/PreAkiModLoader.d.ts b/Live/CWX_DebugTool/dist/types/loaders/PreAkiModLoader.d.ts index d310ae2..4ab1689 100644 --- a/Live/CWX_DebugTool/dist/types/loaders/PreAkiModLoader.d.ts +++ b/Live/CWX_DebugTool/dist/types/loaders/PreAkiModLoader.d.ts @@ -44,9 +44,9 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getDuplicates(stringArray: string[]): string[]; /** - * - * @param mods Get an array of broken/invalid mods by name - * @returns Mod names array + * Get an array of mods with errors that prevent them from working with SPT + * @param mods mods to validate + * @returns Mod names as array */ protected getBrokenMods(mods: string[]): string[]; /** @@ -68,7 +68,12 @@ export declare class PreAkiModLoader implements IModLoader { protected addMod(mod: string): Promise; protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record): boolean; protected isModCompatible(mod: IPackageJsonData, loadedMods: Record): boolean; - protected validMod(mod: string): boolean; + /** + * Validate a mod passes a number of checks + * @param modName name of mod in /mods/ to validate + * @returns true if valid + */ + protected validMod(modName: string): boolean; protected getLoadOrderRecursive(mod: string, result: Record, visited: Record): void; protected getLoadOrder(mods: Record): Record; getContainer(): DependencyContainer; diff --git a/Live/CWX_DebugTool/dist/types/models/eft/common/IGlobals.d.ts b/Live/CWX_DebugTool/dist/types/models/eft/common/IGlobals.d.ts index 9d28dbc..81e2023 100644 --- a/Live/CWX_DebugTool/dist/types/models/eft/common/IGlobals.d.ts +++ b/Live/CWX_DebugTool/dist/types/models/eft/common/IGlobals.d.ts @@ -1175,5 +1175,6 @@ export interface Preset { _name: string; _parent: string; _items: Item[]; + /** Default presets have this property */ _encyclopedia?: string; } diff --git a/Live/CWX_DebugTool/dist/types/models/eft/common/tables/IBotBase.d.ts b/Live/CWX_DebugTool/dist/types/models/eft/common/tables/IBotBase.d.ts index 64166f4..25cb861 100644 --- a/Live/CWX_DebugTool/dist/types/models/eft/common/tables/IBotBase.d.ts +++ b/Live/CWX_DebugTool/dist/types/models/eft/common/tables/IBotBase.d.ts @@ -28,6 +28,8 @@ export interface IBotBase { CarExtractCounts: CarExtractCounts; SurvivorClass: SurvivorClass; WishList: string[]; + /** SPT specific property used during bot generation in raid */ + sptIsPmc?: boolean; } export interface Info { EntryPoint: string; diff --git a/Live/CWX_DebugTool/dist/types/models/eft/common/tables/ITemplateItem.d.ts b/Live/CWX_DebugTool/dist/types/models/eft/common/tables/ITemplateItem.d.ts index 23a1a14..8569e61 100644 --- a/Live/CWX_DebugTool/dist/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/Live/CWX_DebugTool/dist/types/models/eft/common/tables/ITemplateItem.d.ts @@ -34,6 +34,7 @@ export interface Props { LootExperience?: number; ExamineExperience?: number; HideEntrails?: boolean; + InsuranceDisabled?: boolean; RepairCost?: number; RepairSpeed?: number; ExtraSizeLeft?: number; @@ -79,7 +80,7 @@ export interface Props { HasShoulderContact?: boolean; SightingRange?: number; DoubleActionAccuracyPenaltyMult?: number; - ModesCount: any; + ModesCount?: any; DurabilityBurnModificator?: number; HeatFactor?: number; CoolFactor?: number; @@ -155,7 +156,7 @@ export interface Props { RigLayoutName?: string; MaxDurability?: number; armorZone?: string[]; - armorClass: any; + armorClass?: any; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -206,6 +207,7 @@ export interface Props { IsOneoff?: boolean; MustBoltBeOpennedForExternalReload?: boolean; MustBoltBeOpennedForInternalReload?: boolean; + NoFiremodeOnBoltcatch?: boolean; BoltAction?: boolean; HipAccuracyRestorationDelay?: number; HipAccuracyRestorationSpeed?: number; @@ -252,8 +254,8 @@ export interface Props { foodUseTime?: number; foodEffectType?: string; StimulatorBuffs?: string; - effects_health: any; - effects_damage: any; + effects_health?: any; + effects_damage?: any; MaximumNumberOfUsage?: number; knifeHitDelay?: number; knifeHitSlashRate?: number; diff --git a/Live/CWX_DebugTool/dist/types/models/eft/common/tables/ITrader.d.ts b/Live/CWX_DebugTool/dist/types/models/eft/common/tables/ITrader.d.ts index a84f5af..37b2d61 100644 --- a/Live/CWX_DebugTool/dist/types/models/eft/common/tables/ITrader.d.ts +++ b/Live/CWX_DebugTool/dist/types/models/eft/common/tables/ITrader.d.ts @@ -67,6 +67,7 @@ export interface IBarterScheme { count: number; _tpl: string; onlyFunctional?: boolean; + sptQuestLocked?: boolean; } export interface ISuit { _id: string; diff --git a/Live/CWX_DebugTool/dist/types/models/eft/ragfair/IRagfairOffer.d.ts b/Live/CWX_DebugTool/dist/types/models/eft/ragfair/IRagfairOffer.d.ts index 63f655e..141b605 100644 --- a/Live/CWX_DebugTool/dist/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/Live/CWX_DebugTool/dist/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -15,6 +15,8 @@ export interface IRagfairOffer { name?: string; shortName?: string; loyaltyLevel: number; + buyRestrictionMax?: number; + buyRestrictionCurrent?: number; locked: boolean; unlimitedCount: boolean; summaryCost: number; diff --git a/Live/CWX_DebugTool/dist/types/models/enums/AmmoTypes.d.ts b/Live/CWX_DebugTool/dist/types/models/enums/AmmoTypes.d.ts index b52ddcf..254b410 100644 --- a/Live/CWX_DebugTool/dist/types/models/enums/AmmoTypes.d.ts +++ b/Live/CWX_DebugTool/dist/types/models/enums/AmmoTypes.d.ts @@ -23,7 +23,7 @@ export declare enum Ammo762x54 { BT_GZH = "5e023d34e8a400319a28ed44", BS_GZH = "5e023d48186a883be655e551" } -export declare enum Ammo338Lapua { +export declare enum Ammo86x70 { TAC_X = "5fc382b6d6fa9c00c571bbc3", UCW = "5fc382c1016cce60e8341b20", AP = "5fc382a9d724d907e2077dab", @@ -85,13 +85,13 @@ export declare enum Ammo9x21 { PE_GZH = "5a26ac06c4a282000c5a90a8", BT_GZH = "5a26ac0ec4a28200741e1e18" } -export declare enum Ammo357Mag { +export declare enum Ammo9x33R { FMJ = "62330b3ed4dc74626d570b95", HOLLOW_POINT = "62330bfadc5883093563729b", SOFT_POINT = "62330c40bdd19b369e1e53d1", JACKET_HP = "62330c18744e5e31df12f516" } -export declare enum Ammo45ACP { +export declare enum Ammo1143x23ACP { MATCH_FMJ = "5e81f423763d9f754677bf2e", HYDRA_SHOK = "5efb0fc6aeb21837e749c801", LASERMATCH_FMJ = "5efb0d4f4bc50b58e81710f3", @@ -126,7 +126,7 @@ export declare enum Ammo556x45 { MK_318_MOD_0_SOST = "60194943740c5d77f6705eea", SSA_AP = "601949593ae8f707c4608daa" } -export declare enum Ammo300Blackout { +export declare enum Ammo762x35 { M62_TRACER = "619636be6db0f2477964e710", BCP_FMJ = "5fbe3ffdf8b6a877a729ea82", AP = "5fd20ff893a8961fc660a954", diff --git a/Live/CWX_DebugTool/dist/types/models/enums/BaseClasses.d.ts b/Live/CWX_DebugTool/dist/types/models/enums/BaseClasses.d.ts index e733bca..36ebc71 100644 --- a/Live/CWX_DebugTool/dist/types/models/enums/BaseClasses.d.ts +++ b/Live/CWX_DebugTool/dist/types/models/enums/BaseClasses.d.ts @@ -25,6 +25,7 @@ export declare enum BaseClasses { SIGHTS = "5448fe7a4bdc2d6f028b456b", MEDS = "543be5664bdc2dd4348b4569", MONEY = "543be5dd4bdc2deb348b4569", + NIGHTVISION = "5a2c3a9486f774688b05e574", KEY = "543be5e94bdc2df1348b4568", KEY_MECHANICAL = "5c99f98d86f7745c314214b3", KEYCARD = "5c164d2286f774194c5e69fa", @@ -66,8 +67,8 @@ export declare enum BaseClasses { LUBRICANT = "57864e4c24597754843f8723", BATTERY = "57864ee62459775490116fc1", ASSAULT_SCOPE = "55818add4bdc2d5b648b456f", - REFLEX_SIGHT = "55818ad54bdc2ddc698b4569", TACTICAL_COMBO = "55818b164bdc2ddc698b456c", + FLASHLIGHT = "55818b084bdc2d5b648b4571", MAGAZINE = "5448bc234bdc2d3c308b4569", LIGHT_LASER = "55818b0e4bdc2dde698b456e", FLASH_HIDER = "550aa4bf4bdc2dd6348b456b", diff --git a/Live/CWX_DebugTool/dist/types/models/enums/ConfigTypes.d.ts b/Live/CWX_DebugTool/dist/types/models/enums/ConfigTypes.d.ts index 61d6f99..468ece5 100644 --- a/Live/CWX_DebugTool/dist/types/models/enums/ConfigTypes.d.ts +++ b/Live/CWX_DebugTool/dist/types/models/enums/ConfigTypes.d.ts @@ -8,6 +8,7 @@ export declare enum ConfigTypes { IN_RAID = "aki-inraid", INSURANCE = "aki-insurance", INVENTORY = "aki-inventory", + ITEM = "aki-item", LOCALE = "aki-locale", LOCATION = "aki-location", MATCH = "aki-match", diff --git a/Live/CWX_DebugTool/dist/types/models/enums/ELocationName.d.ts b/Live/CWX_DebugTool/dist/types/models/enums/ELocationName.d.ts index b56cc08..7ae7caa 100644 --- a/Live/CWX_DebugTool/dist/types/models/enums/ELocationName.d.ts +++ b/Live/CWX_DebugTool/dist/types/models/enums/ELocationName.d.ts @@ -1,5 +1,6 @@ export declare enum ELocationName { FACTORY_DAY = "factory4_day", + FACTORY_NIGHT = "factory4_night", BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", diff --git a/Live/CWX_DebugTool/dist/types/models/enums/WeaponTypes.d.ts b/Live/CWX_DebugTool/dist/types/models/enums/WeaponTypes.d.ts new file mode 100644 index 0000000..867b052 --- /dev/null +++ b/Live/CWX_DebugTool/dist/types/models/enums/WeaponTypes.d.ts @@ -0,0 +1,151 @@ +export declare enum Weapons127x55 { + ASH_12 = "5cadfbf7ae92152ac412eeef" +} +export declare enum Weapons86x70 { + MK_18 = "5fc22d7c187fea44d52eda44", + AXMC = "627e14b21713922ded6f2c15" +} +export declare enum Weapons9x39 { + AS_VAL = "57c44b372459772d2b39b8ce", + VSS_VINTOREZ = "57838ad32459774a17445cd2" +} +export declare enum Weapons762x54R { + SVDS = "5c46fbd72e2216398b5a8c9c", + MP_18 = "61f7c9e189e6fb1a5e3ea78d", + MOSIN_INFANTRY = "5bfd297f0db834001a669119", + MOSIN_SNIPER = "5ae08f0a5acfc408fb1398a1", + SV_98 = "55801eed4bdc2d89578b4588" +} +export declare enum Weapons762x51 { + VPO_101 = "5c501a4d2e221602b412b540", + DT_MDR_762 = "5dcbd56fdbd3d91b3e5468d5", + SA_58 = "5b0bbe4e5acfc40dc528a72d", + SCARH_BLACK = "6183afd850224f204c1da514", + SCARH_FDE = "6165ac306ef05c2ce828ef74", + HK_G28 = "6176aca650224f204c1da3fb", + M1A = "5aafa857e5b5b00018480968", + RFB = "5f2a9575926fd9352339381f", + RSASS = "5a367e5dc4a282000e49738f", + SR_25 = "5df8ce05b11454561e39243b", + DVL_10 = "588892092459774ac91d4b11", + M700 = "5bfea6e90db834001b7347f3", + T5000M = "5df24cf80dee1b22f862e9bc" +} +export declare enum Weapons366TKM { + VPO_209 = "59e6687d86f77411d949b251", + VPO_215 = "5de652c31b7e3716273428be" +} +export declare enum Weapons762x39 { + OP_SKS = "587e02ff24597743df3deaeb", + SKS = "574d967124597745970e7c94", + AK_103 = "5ac66d2e5acfc43b321d4b53", + AK_104 = "5ac66d725acfc43b321d4b60", + AKM = "59d6088586f774275f37482f", + AKMN = "5a0ec13bfcdbcb00165aa685", + AKMS = "59ff346386f77477562ff5e2", + AKMSN = "5abcbc27d8ce8700182eceeb", + MK47_MUTANT = "606587252535c57a13424cfd", + RD_704 = "628a60ae6b1d481ff772e9c8", + VPO_136 = "59e6152586f77473dc057aa1" +} +export declare enum Weapons762x35 { + MCX = "5fbcc1d9016cce60e8341ab3" +} +export declare enum Weapons556x45 { + ADAR_2_15 = "5c07c60e0db834002330051f", + AK_101 = "5ac66cb05acfc40198510a10", + AK_102 = "5ac66d015acfc400180ae6e4", + DT_MDR_556 = "5c488a752e221602b412af63", + HK_416A5 = "5bb2475ed4351e00853264e3", + HK_G36 = "623063e994fc3f7b302a9696", + M4A1 = "5447a9cd4bdc2dbd208b4567", + SCARL_BLACK = "6184055050224f204c1da540", + SCARL_FDE = "618428466ef05c2ce828f218", + TX15_DML = "5d43021ca4b9362eab4b5e25" +} +export declare enum Weapons545x39 { + AK_105 = "5ac66d9b5acfc4001633997a", + AK_74 = "5bf3e03b0db834001d2c4a9c", + AK_74M = "5ac4cd105acfc40016339859", + AK_74N = "5644bd2b4bdc2d3b4c8b4572", + AKS_74 = "5bf3e0490db83400196199af", + AKS_74N = "5ab8e9fcd8ce870019439434", + AKS_74U = "57dc2fa62459775949412633", + AKS_74UB = "5839a40f24597726f856b511", + AKS_74UN = "583990e32459771419544dd2", + SAG_AK = "628b5638ad252a16da6dd245", + SAG_AK_SHORT = "628b9c37a733087d0d7fe84b", + RPK_16 = "5beed0f50db834001c062b12" +} +export declare enum Weapons57x28FN { + FN_57_BLACK = "5d3eb3b0a4b93615055e84d2", + FN_57_FDE = "5d67abc1a4b93614ec50137f", + FN_P90 = "5cc82d76e24e8d00134b4b83" +} +export declare enum Weapons46x30HK { + MP7A1 = "5ba26383d4351e00334c93d9", + MP7A2 = "5bd70322209c4d00d7167b8f" +} +export declare enum Weapons1143x23 { + M1911A1 = "5e81c3cbac2bb513793cdc75", + M45A1 = "5f36a0e5fbf956000b716b65", + USP45 = "6193a720f8ee7e52e42109ed", + UMP45 = "5fc3e272f8b6a877a729eac5", + VECTOR45 = "5fb64bc92b1b027b1f50bcf2" +} +export declare enum Weapons9x33R { + CR_50DS = "61a4c8884f95bc3b2c5dc96f" +} +export declare enum Weapons9x21 { + SR_1MP = "59f98b4986f7746f546d2cef" +} +export declare enum Weapons9x19 { + GLOCK_17 = "5a7ae0c351dfba0017554310", + GLOCK_18C = "5b1fa9b25acfc40018633c01", + M9A3 = "5cadc190ae921500103bb3b6", + MP_443 = "576a581d2459771e7b1bc4f1", + P226R = "56d59856d2720bd8418b456a", + PL_15 = "602a9740da11d6478d5a06dc", + CR_200DS = "624c2e8614da335f1e034d8c", + MP5 = "5926bb2186f7744b1c6c6e60", + MP5K = "5d2f0d8048f0356c925bc3b0", + MP9 = "5e00903ae9dc277128008b87", + MP9_N = "5de7bd7bfd6b4e6e2276dc25", + MPX = "58948c8e86f77409493f7266", + PP_19_01 = "59984ab886f7743e98271174", + SAIGA_9 = "59f9cabd86f7743a10721f46", + STM_9 = "60339954d62c9b14ed777c06", + VECTOR_9MM = "5fc3f2d5900b1d5091531e57" +} +export declare enum Weapons9x18 { + APB = "5abccb7dd8ce87001773e277", + APS = "5a17f98cfcdbcb0980087290", + PB_SILENCED = "56e0598dd2720bb5668b45a6", + PM = "5448bd6b4bdc2dfc2f8b4569", + PM_T = "579204f224597773d619e051", + PP9_KLIN = "57f4c844245977379d5c14d1", + PP91_KEDR = "57d14d2524597714373db789", + PP91_KEDRB = "57f3c6bd24597738e730fa2f" +} +export declare enum Weapons762x25 { + TT = "571a12c42459771f627b58a0", + TT_GOLD = "5b3b713c5acfc4330140bd8d", + PPSH_41 = "5ea03f7400685063ec28bfa8" +} +export declare enum Weapons12Gauge { + M3_SUPER90 = "6259b864ebedf17603599e88", + M590A1 = "5e870397991fd70db46995c8", + M870 = "5a7828548dc32e5a9c28b516", + MP_133 = "54491c4f4bdc2db1078b4568", + MP_153 = "56dee2bdd2720bc8328b4567", + MP_155 = "606dae0ab0e443224b421bb7", + MP_43_1C = "5580223e4bdc2d1c128b457f", + MTS_255_12 = "60db29ce99594040e04c4a27", + SAIGA_12GA = "576165642459773c7a400233" +} +export declare enum Weapons20Gauge { + TOZ_106 = "5a38e6bac4a2826c6e06d79b" +} +export declare enum Weapons23x75 { + KS_23M = "5e848cc2988a8701445df1e8" +} diff --git a/Live/CWX_DebugTool/dist/types/models/spt/config/IAirdropConfig.d.ts b/Live/CWX_DebugTool/dist/types/models/spt/config/IAirdropConfig.d.ts index f4aee89..3edcbdd 100644 --- a/Live/CWX_DebugTool/dist/types/models/spt/config/IAirdropConfig.d.ts +++ b/Live/CWX_DebugTool/dist/types/models/spt/config/IAirdropConfig.d.ts @@ -1,14 +1,14 @@ +import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IAirdropConfig extends IBaseConfig { kind: "aki-airdrop"; airdropChancePercent: AirdropChancePercent; - airdropMinOpenHeight: number; - airdropMaxOpenHeight: number; planeMinFlyHeight: number; planeMaxFlyHeight: number; planeVolume: number; airdropMinStartTimeSeconds: number; airdropMaxStartTimeSeconds: number; + loot: AirdropLoot; } export interface AirdropChancePercent { bigmap: number; @@ -18,3 +18,13 @@ export interface AirdropChancePercent { interchange: number; reserve: number; } +export interface AirdropLoot { + presetCount: MinMax; + itemCount: MinMax; + itemBlacklist: string[]; + itemTypeWhitelist: string[]; + /** key: item base type: value: max count */ + itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; +} diff --git a/Live/CWX_DebugTool/dist/types/models/spt/config/IBotConfig.d.ts b/Live/CWX_DebugTool/dist/types/models/spt/config/IBotConfig.d.ts index e171087..af8ceba 100644 --- a/Live/CWX_DebugTool/dist/types/models/spt/config/IBotConfig.d.ts +++ b/Live/CWX_DebugTool/dist/types/models/spt/config/IBotConfig.d.ts @@ -1,17 +1,31 @@ import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; +import { IBotDurability } from "./IBotDurability"; +import { IPmcConfig } from "./IPmcConfig"; export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; + /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** What bot types should be classified as bosses */ bosses: string[]; - durability: Durability; + /** Control weapon/armor durability min/max values for each bot type */ + durability: IBotDurability; + /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ lootNValue: LootNvalue; + /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; - pmc: PmcConfig; + /** PMC bot specific config settings */ + pmc: IPmcConfig; + /** Control how many items are allowed to spawn on a bot + * key: bottype, value: */ itemSpawnLimits: Record>; - equipment: Record; + /** Blacklist/whitelist items on a bot */ + equipment: Record; + /** Show a bots botType value after their name */ showTypeInNickname: boolean; - maxBotCap: number; + /** Max number of bots that can be spawned in a raid at any one time */ + maxBotCap: Record; + /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; } export interface PresetBatch { @@ -44,79 +58,23 @@ export interface PresetBatch { test: number; exUsec: number; } -export interface Durability { - default: DefaultDurability; - pmc: PmcDurability; - boss: BotDurability; - follower: BotDurability; - assault: BotDurability; - cursedassault: BotDurability; - marksman: BotDurability; - pmcbot: BotDurability; - exusec: BotDurability; - sectantpriest: BotDurability; - sectantwarrior: BotDurability; -} -export interface DefaultDurability { - armor: DefaultArmor; - weapon: WeaponDurability; -} -export interface DefaultArmor { - maxDelta: number; - minDelta: number; -} -export interface WeaponDurability { - lowestMax: number; - highestMax: number; - maxDelta: number; - minDelta: number; -} -export interface PmcDurability { - armor: PmcDurabilityArmor; - weapon: WeaponDurability; -} -export interface PmcDurabilityArmor { - lowestMaxPercent: number; - highestMaxPercent: number; - maxDelta: number; - minDelta: number; -} -export interface BotDurability { - armor: ArmorDurability; - weapon: WeaponDurability; -} -export interface ArmorDurability { - maxDelta: number; - minDelta: number; -} export interface LootNvalue { scav: number; pmc: number; } -export interface PmcConfig { - dynamicLoot: PmcDynamicLoot; - difficulty: string; - looseWeaponInBackpackChancePercent: number; - looseWeaponInBackpackLootMinMax: MinMax; - isUsec: number; - chanceSameSideIsHostilePercent: number; - usecType: string; - bearType: string; - maxBackpackLootTotalRub: number; - maxPocketLootTotalRub: number; - maxVestLootTotalRub: number; - convertIntoPmcChance: Record; - enemyTypes: string[]; -} -export interface PmcDynamicLoot { - whitelist: string[]; - blacklist: string[]; - moneyStackLimits: Record; -} -export interface Equipment { +export interface EquipmentFilters { + weaponModLimits: ModLimits; + randomisedWeaponModSlots?: string[]; + randomisedArmorSlots?: string[]; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; } +export interface ModLimits { + /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ + scopeLimit?: number; + /** How many lasers or lights are allowed on a weapon - hard coded to work with TACTICAL_COMBO, and FLASHLIGHT */ + lightLaserLimit?: number; +} export interface EquipmentFilterDetails { levelRange: MinMax; equipment: Record; diff --git a/Live/CWX_DebugTool/dist/types/models/spt/config/IBotDurability.d.ts b/Live/CWX_DebugTool/dist/types/models/spt/config/IBotDurability.d.ts new file mode 100644 index 0000000..38a47cc --- /dev/null +++ b/Live/CWX_DebugTool/dist/types/models/spt/config/IBotDurability.d.ts @@ -0,0 +1,47 @@ +export interface IBotDurability { + default: DefaultDurability; + pmc: PmcDurability; + boss: BotDurability; + follower: BotDurability; + assault: BotDurability; + cursedassault: BotDurability; + marksman: BotDurability; + pmcbot: BotDurability; + exusec: BotDurability; + gifter: BotDurability; + sectantpriest: BotDurability; + sectantwarrior: BotDurability; +} +/** Durability values to be used when a more specific bot type cant be found */ +export interface DefaultDurability { + armor: DefaultArmor; + weapon: WeaponDurability; +} +export interface DefaultArmor { + maxDelta: number; + minDelta: number; +} +export interface WeaponDurability { + lowestMax: number; + highestMax: number; + maxDelta: number; + minDelta: number; +} +export interface PmcDurability { + armor: PmcDurabilityArmor; + weapon: WeaponDurability; +} +export interface PmcDurabilityArmor { + lowestMaxPercent: number; + highestMaxPercent: number; + maxDelta: number; + minDelta: number; +} +export interface BotDurability { + armor: ArmorDurability; + weapon: WeaponDurability; +} +export interface ArmorDurability { + maxDelta: number; + minDelta: number; +} diff --git a/Live/CWX_DebugTool/dist/types/models/spt/config/IItemConfig.d.ts b/Live/CWX_DebugTool/dist/types/models/spt/config/IItemConfig.d.ts new file mode 100644 index 0000000..5ecccc2 --- /dev/null +++ b/Live/CWX_DebugTool/dist/types/models/spt/config/IItemConfig.d.ts @@ -0,0 +1,5 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface IItemConfig extends IBaseConfig { + kind: "aki-item"; + blacklist: string[]; +} diff --git a/Live/CWX_DebugTool/dist/types/models/spt/config/IPmcConfig.d.ts b/Live/CWX_DebugTool/dist/types/models/spt/config/IPmcConfig.d.ts new file mode 100644 index 0000000..9db2ba1 --- /dev/null +++ b/Live/CWX_DebugTool/dist/types/models/spt/config/IPmcConfig.d.ts @@ -0,0 +1,26 @@ +import { MinMax } from "../../common/MinMax"; +export interface IPmcConfig { + dynamicLoot: DynamicLoot; + useDifficultyOverride: boolean; + difficulty: string; + looseWeaponInBackpackChancePercent: number; + looseWeaponInBackpackLootMinMax: MinMax; + isUsec: number; + chanceSameSideIsHostilePercent: number; + /** key: location, value: type for usec/bear */ + pmcType: Record; + maxBackpackLootTotalRub: number; + maxPocketLootTotalRub: number; + maxVestLootTotalRub: number; + convertIntoPmcChance: Record; + enemyTypes: string[]; +} +export interface PmcTypes { + usec: string; + bear: string; +} +export interface DynamicLoot { + whitelist: string[]; + blacklist: string[]; + moneyStackLimits: Record; +} diff --git a/Live/CWX_DebugTool/dist/types/models/spt/config/IQuestConfig.d.ts b/Live/CWX_DebugTool/dist/types/models/spt/config/IQuestConfig.d.ts index be4a97b..45c9aae 100644 --- a/Live/CWX_DebugTool/dist/types/models/spt/config/IQuestConfig.d.ts +++ b/Live/CWX_DebugTool/dist/types/models/spt/config/IQuestConfig.d.ts @@ -4,6 +4,8 @@ export interface IQuestConfig extends IBaseConfig { kind: "aki-quest"; redeemTime: number; repeatableQuests: IRepeatableQuestConfig[]; + bearOnlyQuests: string[]; + usecOnlyQuests: string[]; } export interface IRepeatableQuestConfig { name: string; @@ -15,6 +17,10 @@ export interface IRepeatableQuestConfig { locations: Record; traderWhitelist: ITraderWhitelist[]; questConfig: IQuestConfig; + /** Item base types to block when generating rewards */ + rewardBaseTypeBlacklist: string[]; + /** Item tplIds to ignore when generating rewards */ + rewardBlacklist: string[]; } export interface IRewardScaling { levels: number[]; diff --git a/Live/CWX_DebugTool/dist/types/models/spt/config/IRagfairConfig.d.ts b/Live/CWX_DebugTool/dist/types/models/spt/config/IRagfairConfig.d.ts index 6369eda..c1b8763 100644 --- a/Live/CWX_DebugTool/dist/types/models/spt/config/IRagfairConfig.d.ts +++ b/Live/CWX_DebugTool/dist/types/models/spt/config/IRagfairConfig.d.ts @@ -12,6 +12,7 @@ export interface Sell { chance: Chance; time: Time; reputation: Reputation; + simulatedSellHours: number; } export interface Chance { base: number; @@ -38,6 +39,7 @@ export interface Dynamic { offerItemCount: MinMax; price: MinMax; presetPrice: MinMax; + showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; condition: Condition; stackablePercent: MinMax; diff --git a/Live/CWX_DebugTool/dist/types/models/spt/config/ITraderConfig.d.ts b/Live/CWX_DebugTool/dist/types/models/spt/config/ITraderConfig.d.ts index c8e8044..6b1c1e3 100644 --- a/Live/CWX_DebugTool/dist/types/models/spt/config/ITraderConfig.d.ts +++ b/Live/CWX_DebugTool/dist/types/models/spt/config/ITraderConfig.d.ts @@ -12,8 +12,10 @@ export interface UpdateTime { seconds: number; } export interface FenceConfig { + partialRefreshTimeSeconds: number; + partialRefreshChangePercent: number; assortSize: number; - maxPresetsCount: number; + maxPresetsPercent: number; presetPriceMult: number; blacklist: string[]; } diff --git a/Live/CWX_DebugTool/dist/types/models/spt/location/AirDropLootItem.d.ts b/Live/CWX_DebugTool/dist/types/models/spt/location/AirDropLootItem.d.ts new file mode 100644 index 0000000..da791ff --- /dev/null +++ b/Live/CWX_DebugTool/dist/types/models/spt/location/AirDropLootItem.d.ts @@ -0,0 +1,6 @@ +export declare class AirDropLootItem { + id: string; + tpl: string; + isPreset: boolean; + stackCount: number; +} diff --git a/Live/CWX_DebugTool/dist/types/models/spt/services/LootItem.d.ts b/Live/CWX_DebugTool/dist/types/models/spt/services/LootItem.d.ts new file mode 100644 index 0000000..acb7606 --- /dev/null +++ b/Live/CWX_DebugTool/dist/types/models/spt/services/LootItem.d.ts @@ -0,0 +1,6 @@ +export declare class LootItem { + id?: string; + tpl: string; + isPreset: boolean; + stackCount: number; +} diff --git a/Live/CWX_DebugTool/dist/types/models/spt/services/LootRequest.d.ts b/Live/CWX_DebugTool/dist/types/models/spt/services/LootRequest.d.ts new file mode 100644 index 0000000..1da8770 --- /dev/null +++ b/Live/CWX_DebugTool/dist/types/models/spt/services/LootRequest.d.ts @@ -0,0 +1,11 @@ +import { MinMax } from "../../common/MinMax"; +export declare class LootRequest { + presetCount: MinMax; + itemCount: MinMax; + itemBlacklist: string[]; + itemTypeWhitelist: string[]; + /** key: item base type: value: max count */ + itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; +} diff --git a/Live/CWX_DebugTool/dist/types/servers/DatabaseServer.d.ts b/Live/CWX_DebugTool/dist/types/servers/DatabaseServer.d.ts index aa152d0..b3d29e9 100644 --- a/Live/CWX_DebugTool/dist/types/servers/DatabaseServer.d.ts +++ b/Live/CWX_DebugTool/dist/types/servers/DatabaseServer.d.ts @@ -2,5 +2,5 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; export declare class DatabaseServer { protected tableData: IDatabaseTables; getTables(): IDatabaseTables; - setTables(any: any): void; + setTables(tableData: IDatabaseTables): void; } diff --git a/Live/CWX_DebugTool/dist/types/services/BotEquipmentFilterService.d.ts b/Live/CWX_DebugTool/dist/types/services/BotEquipmentFilterService.d.ts index e49645b..632f961 100644 --- a/Live/CWX_DebugTool/dist/types/services/BotEquipmentFilterService.d.ts +++ b/Live/CWX_DebugTool/dist/types/services/BotEquipmentFilterService.d.ts @@ -1,12 +1,12 @@ import { IBotType } from "../models/eft/common/tables/IBotType"; -import { Equipment, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; protected configServer: ConfigServer; protected botConfig: IBotConfig; - protected botEquipmentFilterlists: Record; + protected botEquipmentFilterlists: Record; constructor(logger: ILogger, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig @@ -22,7 +22,7 @@ export declare class BotEquipmentFilterService { * @param playerLevel Level of the player * @returns EquipmentBlacklistDetails object */ - protected getBotEquipmentBlacklist(botRole: string, playerLevel: number): EquipmentFilterDetails; + getBotEquipmentBlacklist(botRole: string, playerLevel: number): EquipmentFilterDetails; /** * Get the whitelist for a specific bot type that's within the players level * @param botRole Bot type diff --git a/Live/CWX_DebugTool/dist/types/services/BotGenerationCacheService.d.ts b/Live/CWX_DebugTool/dist/types/services/BotGenerationCacheService.d.ts new file mode 100644 index 0000000..670c583 --- /dev/null +++ b/Live/CWX_DebugTool/dist/types/services/BotGenerationCacheService.d.ts @@ -0,0 +1,52 @@ +import { BotHelper } from "../helpers/BotHelper"; +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotGenerationCacheService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected botHelper: BotHelper; + protected storedBots: IBotBase[]; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); + /** + * Store array of bots in cache, shuffle results before storage + * @param botsToStore + */ + storeBots(botsToStore: IBotBase[]): void; + /** + * Find and return a bot based on its role + * Remove bot from internal array so it can't be retreived again + * @param role role to retreive (assault/bossTagilla etc) + * @returns IBotBase object + */ + getBot(role: string): IBotBase[]; + /** + * Find a bot by its index from cache + * @param indexOfBotToReturn index to find bot by + * @returns bot profile + */ + protected getBotFromCache(indexOfBotToReturn: number): IBotBase; + /** + * Remove bot profile by index from cache + * @param indexOfBotToReturn Index of bot profile to remove + */ + protected removeBotFromCache(indexOfBotToReturn: number): void; + /** + * Get index of bot profile that matches criteria + * @param role role of bot we want + * @param getPmc is requested bot a pmc + * @returns index of found bot + */ + protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; + /** + * Remove all cached bot profiles + */ + clearStoredBots(): void; + /** + * Does cache have bots + * @returns true if empty + */ + cacheIsEmpty(): boolean; +} diff --git a/Live/CWX_DebugTool/dist/types/services/BotLootCacheService.d.ts b/Live/CWX_DebugTool/dist/types/services/BotLootCacheService.d.ts index cc71eee..00ffb9c 100644 --- a/Live/CWX_DebugTool/dist/types/services/BotLootCacheService.d.ts +++ b/Live/CWX_DebugTool/dist/types/services/BotLootCacheService.d.ts @@ -34,6 +34,17 @@ export declare class BotLootCacheService { * @param isPmc Is the bot a PMC (alteres what loot is cached) */ protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; + /** + * Sort a pool of item objects by its flea price + * @param poolToSort pool of items to sort + */ + protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; + /** + * Add unique items into combined pool + * @param combinedItemPool Pool of items to add to + * @param itemsToAdd items to add to combined pool if unique + */ + protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; /** * Ammo/grenades have this property * @param props diff --git a/Live/CWX_DebugTool/dist/types/services/FenceService.d.ts b/Live/CWX_DebugTool/dist/types/services/FenceService.d.ts index c9e325e..23fbf52 100644 --- a/Live/CWX_DebugTool/dist/types/services/FenceService.d.ts +++ b/Live/CWX_DebugTool/dist/types/services/FenceService.d.ts @@ -12,6 +12,11 @@ import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { ItemFilterService } from "./ItemFilterService"; +/** + * Handle actions surrounding Fence + * e.g. generating or refreshing assorts / get next refresh time + */ export declare class FenceService { protected logger: ILogger; protected hashUtil: HashUtil; @@ -22,18 +27,75 @@ export declare class FenceService { protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); + protected nextMiniRefreshTimestamp: number; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; - getFenceAssorts(): ITraderAssort; + /** + * Get assorts player can purchase + * Adjust prices based on fence level of player + * @param pmcProfile Player profile + * @returns ITraderAssort + */ + getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Get fence assorts with no price adjustments based on fence rep + * @returns ITraderAssort + */ + getRawFenceAssorts(): ITraderAssort; + /** + * Does fence need to perform a partial refresh because its passed the refresh timer defined in trader.json + * @returns true if it needs a partial refresh + */ + needsPartialRefresh(): boolean; + /** + * Replace a percentage of fence assorts with freshly generated items + */ + performPartialRefresh(): void; + /** + * Increment fence next refresh timestamp by current timestamp + partialRefreshTimeSeconds from config + */ + protected incrementPartialRefreshTime(): void; + /** + * Compare the current fence offer count to what the config wants it to be, + * If value is lower add extra count to value to generate more items to fill gap + * @param existingItemCountToReplace count of items to generate + * @returns number of items to generate + */ + protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + /** + * Choose an item (not mod) at random and remove from assorts + */ + protected removeRandomItemFromAssorts(): void; + /** + * Get an integer rounded count of items to replace based on percentrage from traderConfig value + * @param totalItemCount total item count + * @returns rounded int of items to replace + */ + protected getCountOfItemsToReplace(totalItemCount: number): number; /** * Get the count of items fence offers * @returns number */ getOfferCount(): number; - generateFenceAssortCache(pmcData: IPmcData): void; + /** + * Create a trader assort for fence + */ + generateFenceAssortCache(): void; + /** + * Create skeleton to hold assort items + * @returns ITraderAssort object + */ + protected createBaseTraderAssortItem(): ITraderAssort; + /** + * Hydrate result parameter object with generated assorts + * @param assortCount Number of assorts to generate + * @param assorts object to add assorts to + */ + protected createAssorts(assortCount: number, assorts: ITraderAssort): void; /** * Get the next update timestamp for fence * @returns future timestamp @@ -44,11 +106,14 @@ export declare class FenceService { */ protected getFenceRefreshTime(): number; /** - * Get the fence level the passed in profile has + * Get fence level the passed in profile has * @param pmcData Player profile - * @returns FenceLevel + * @returns FenceLevel object */ getFenceInfo(pmcData: IPmcData): FenceLevel; + /** + * Remove an assort from fence by id + * @param assortIdToRemove assort id to remove from fence assorts + */ removeFenceOffer(assortIdToRemove: string): void; - updateFenceOffers(pmcData: IPmcData): void; } diff --git a/Live/CWX_DebugTool/dist/types/services/InsuranceService.d.ts b/Live/CWX_DebugTool/dist/types/services/InsuranceService.d.ts index 171bf10..6be8a2f 100644 --- a/Live/CWX_DebugTool/dist/types/services/InsuranceService.d.ts +++ b/Live/CWX_DebugTool/dist/types/services/InsuranceService.d.ts @@ -2,6 +2,7 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { InsuredItem } from "../models/eft/common/tables/IBotBase"; import { Item } from "../models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; @@ -44,8 +45,22 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; + /** + * Store lost gear post-raid inside profile + * @param pmcData player profile to store gear in + * @param offraidData post-raid request object + * @param preRaidGear gear player wore prior to raid + * @param sessionID Session id + */ storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string): void; storeInsuredItemsForReturn(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string): void; - protected addGearToSend(pmcData: IPmcData, insuredItem: any, actualItem: any, sessionID: string): any; + /** + * Add gear item to InsuredItems array in player profile + * @param pmcData profile to store item in + * @param insuredItem Item to store in profile + * @param actualItem item to store + * @param sessionID Session id + */ + protected addGearToSend(pmcData: IPmcData, insuredItem: InsuredItem, actualItem: Item, sessionID: string): void; getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; } diff --git a/Live/CWX_DebugTool/dist/types/services/ItemFilterService.d.ts b/Live/CWX_DebugTool/dist/types/services/ItemFilterService.d.ts new file mode 100644 index 0000000..c9c8ef3 --- /dev/null +++ b/Live/CWX_DebugTool/dist/types/services/ItemFilterService.d.ts @@ -0,0 +1,24 @@ +import { IItemConfig } from "../models/spt/config/IItemConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +/** Centralise the handling of blacklisting items, uses blacklist found in config/item.json */ +export declare class ItemFilterService { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected blacklist: string[]; + protected itemConfig: IItemConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Check if the provided template id is blacklisted in config/item.json + * @param tpl template id + * @returns true if blacklisted + */ + isItemBlacklisted(tpl: string): boolean; + /** + * Return every template id blacklisted in config/item.json + * @returns string array of blacklisted tempalte ids + */ + getBlacklistedItems(): string[]; +} diff --git a/Live/CWX_DebugTool/dist/types/services/PmcAiService.d.ts b/Live/CWX_DebugTool/dist/types/services/PmcAiService.d.ts new file mode 100644 index 0000000..0690f1f --- /dev/null +++ b/Live/CWX_DebugTool/dist/types/services/PmcAiService.d.ts @@ -0,0 +1,27 @@ +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +/** Storing/retreving pmcRoles set at the start of a raid - its done at that point as we know what location the player is heading to */ +export declare class PmcAiService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + protected usecRole: string; + protected bearRole: string; + constructor(logger: ILogger, configServer: ConfigServer); + /** + * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) + * @param pmcSide eft side (usec/bear) + * @returns pmc side as defined in config + */ + getPmcRole(pmcSide: "usec" | "bear" | string): string; + /** + * Set the roles for pmcs + * @param location map location to look up and use as pmc types + */ + setPmcRolesByLocation(location: string): void; + /** + * Clear the saved role from usec/bear PMCs + */ + clearPmcRoles(): void; +} diff --git a/Live/CWX_DebugTool/dist/types/services/ProfileFixerService.d.ts b/Live/CWX_DebugTool/dist/types/services/ProfileFixerService.d.ts index ed1dec7..9cb5a38 100644 --- a/Live/CWX_DebugTool/dist/types/services/ProfileFixerService.d.ts +++ b/Live/CWX_DebugTool/dist/types/services/ProfileFixerService.d.ts @@ -45,6 +45,11 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to find and remove slots from */ protected removeResourcesFromSlotsInHideoutWithoutLocationIndexValue(pmcProfile: IPmcData): void; + /** + * Hideout slots need to be in a specific order, locationIndex in ascending order + * @param pmcProfile profile to edit + */ + protected reorderHideoutAreasWithResouceInputs(pmcProfile: IPmcData): void; /** * add in objects equal to the number of slots * @param areaType area to check diff --git a/Live/CWX_DebugTool/dist/types/services/RepairService.d.ts b/Live/CWX_DebugTool/dist/types/services/RepairService.d.ts new file mode 100644 index 0000000..3e6077c --- /dev/null +++ b/Live/CWX_DebugTool/dist/types/services/RepairService.d.ts @@ -0,0 +1,75 @@ +import { QuestHelper } from "../helpers/QuestHelper"; +import { RepairHelper } from "../helpers/RepairHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { RepairKitsInfo } from "../models/eft/repair/IRepairActionDataRequest"; +import { RepairItem } from "../models/eft/repair/ITraderRepairActionDataRequest"; +import { IRepairConfig } from "../models/spt/config/IRepairConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ItemEventRouter } from "../routers/ItemEventRouter"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { PaymentService } from "./PaymentService"; +export declare class RepairService { + protected logger: ILogger; + protected itemEventRouter: ItemEventRouter; + protected databaseServer: DatabaseServer; + protected questHelper: QuestHelper; + protected traderHelper: TraderHelper; + protected paymentService: PaymentService; + protected repairHelper: RepairHelper; + protected configServer: ConfigServer; + repairConfig: IRepairConfig; + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + /** + * Use trader to repair an items durability + * @param sessionID Session id + * @param pmcData profile to find item to repair in + * @param repairItemDetails details of the item to repair + * @param traderId Trader being used to repair item + * @returns RepairDetails object + */ + repairItemByTrader(sessionID: string, pmcData: IPmcData, repairItemDetails: RepairItem, traderId: string): RepairDetails; + /** + * + * @param sessionID Session id + * @param pmcData profile to take money from + * @param repairedItemId Repaired item id + * @param repairCost Cost to repair item in roubles + * @param traderId Id of the trader who repaired the item / who is paid + * @param output + */ + payForRepair(sessionID: string, pmcData: IPmcData, repairedItemId: string, repairCost: number, traderId: string, output: IItemEventRouterResponse): void; + /** + * Add skill points to profile after repairing an item + * @param sessionId Session id + * @param repairDetails details of item repaired, cost/item + * @param pmcData Profile to add points to + * @param output IItemEventRouterResponse + */ + addRepairSkillPoints(sessionId: string, repairDetails: RepairDetails, pmcData: IPmcData, output: IItemEventRouterResponse): void; + /** + * + * @param sessionId Session id + * @param pmcData Profile to update repaired item in + * @param repairKits Array of Repair kits to use + * @param itemToRepairId Item id to repair + * @param output IItemEventRouterResponse + * @returns Details of repair, item/price + */ + repairItemByKit(sessionId: string, pmcData: IPmcData, repairKits: RepairKitsInfo[], itemToRepairId: string, output: IItemEventRouterResponse): RepairDetails; + /** + * Update repair kits Resource object if it doesn't exist + * @param repairKitDetails Repair kit details from db + * @param repairKitInInventory Repair kit to update + */ + protected addMaxResourceToKitIfMissing(repairKitDetails: ITemplateItem, repairKitInInventory: Item): void; +} +export declare class RepairDetails { + repairCost?: number; + repairedItem: Item; + repairedItemIsArmor: boolean; +} diff --git a/Live/CWX_DebugTool/dist/types/utils/HashUtil.d.ts b/Live/CWX_DebugTool/dist/types/utils/HashUtil.d.ts index bacbf2a..a8500e1 100644 --- a/Live/CWX_DebugTool/dist/types/utils/HashUtil.d.ts +++ b/Live/CWX_DebugTool/dist/types/utils/HashUtil.d.ts @@ -4,8 +4,18 @@ import { TimeUtil } from "./TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; constructor(timeUtil: TimeUtil); + /** + * Create a 24 character id using the sha256 algorithm + current timestamp + * @returns 24 character hash + */ generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + /** + * Create a hash for the data parameter + * @param algorithm algorithm to use to hash + * @param data data to be hashed + * @returns hash value + */ generateHashForData(algorithm: string, data: crypto.BinaryLike): string; } diff --git a/Live/CWX_DebugTool/dist/types/utils/RandomUtil.d.ts b/Live/CWX_DebugTool/dist/types/utils/RandomUtil.d.ts index c24dd60..633e472 100644 --- a/Live/CWX_DebugTool/dist/types/utils/RandomUtil.d.ts +++ b/Live/CWX_DebugTool/dist/types/utils/RandomUtil.d.ts @@ -136,7 +136,7 @@ export declare class RandomUtil { * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with ot without replacement from the input array + * @param {boolean} replacement Draw with or without replacement from the input array * @return {array} Array consisting of N random elements */ drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; @@ -150,4 +150,10 @@ export declare class RandomUtil { */ drawRandomFromDict(dict: any, count?: number, replacement?: boolean): any[]; getBiasedRandomNumber(min: number, max: number, shift: number, n: number): number; + /** + * Fisher-Yates shuffle an array + * @param array Array to shuffle + * @returns Shuffled array + */ + shuffle(array: Array): Array; } diff --git a/Live/CWX_DebugTool/dist/types/utils/TimeUtil.d.ts b/Live/CWX_DebugTool/dist/types/utils/TimeUtil.d.ts index f437f8a..1367e26 100644 --- a/Live/CWX_DebugTool/dist/types/utils/TimeUtil.d.ts +++ b/Live/CWX_DebugTool/dist/types/utils/TimeUtil.d.ts @@ -1,3 +1,6 @@ +/** + * Utility class to handle time related problems + */ export declare class TimeUtil { static readonly oneHourAsSeconds = 3600; formatTime(date: Date): string; @@ -19,4 +22,10 @@ export declare class TimeUtil { * @returns current date in format: 00.00.0000 (dd.mm.yyyy) */ getDateMailFormat(): string; + /** + * Convert hours into seconds + * @param hours hours to convert to seconds + * @returns number + */ + getHoursAsSeconds(hours: number): number; } diff --git a/Live/CWX_DebugTool/models/IConfig.ts b/Live/CWX_DebugTool/models/IConfig.ts index 3f160f3..29dda5d 100644 --- a/Live/CWX_DebugTool/models/IConfig.ts +++ b/Live/CWX_DebugTool/models/IConfig.ts @@ -36,4 +36,5 @@ export interface itemsConfig { changeShrapProps: boolean changeMaxAmmoForKS23: boolean + removeDevFromBlacklist: boolean } \ No newline at end of file diff --git a/Live/CWX_DebugTool/src/itemsConfig.ts b/Live/CWX_DebugTool/src/itemsConfig.ts index d1f7258..5762e0d 100644 --- a/Live/CWX_DebugTool/src/itemsConfig.ts +++ b/Live/CWX_DebugTool/src/itemsConfig.ts @@ -3,16 +3,21 @@ import { inject, injectable } from "tsyringe"; import { CWX_ConfigHandler } from "./configHandler"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; +import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig" import { IConfig } from "models/IConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; +import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes"; @injectable() export class CWX_ItemsConfig { private tables: Record; private config: IConfig; + private itemConfig: IItemConfig; constructor( @inject("DatabaseServer") private databaseServer: DatabaseServer, + @inject("ConfigServer") private configServer: ConfigServer, @inject("CWX_ConfigHandler") private configHandler: CWX_ConfigHandler ) {} @@ -20,11 +25,14 @@ export class CWX_ItemsConfig public applyChanges(): void { this.tables = this.databaseServer.getTables().templates.items; + this.itemConfig = this.configServer.getConfig(ConfigTypes.ITEM); this.config = this.configHandler.getConfig(); this.changeShrapProps(); this.changeMaxAmmoForKS23(); + this.removeDevFromBlacklist(); } + private changeShrapProps(): void { @@ -46,4 +54,12 @@ export class CWX_ItemsConfig ks23._props.Cartridges[0]._max_count = 30; } } + + private removeDevFromBlacklist(): void + { + if (this.config.itemsConfig.removeDevFromBlacklist) + { + this.itemConfig.blacklist.splice(this.itemConfig.blacklist.indexOf("58ac60eb86f77401897560ff")); + } + } } \ No newline at end of file diff --git a/Live/CWX_DebugTool/types/callbacks/LocationCallbacks.d.ts b/Live/CWX_DebugTool/types/callbacks/LocationCallbacks.d.ts index cc69369..6e0b538 100644 --- a/Live/CWX_DebugTool/types/callbacks/LocationCallbacks.d.ts +++ b/Live/CWX_DebugTool/types/callbacks/LocationCallbacks.d.ts @@ -11,4 +11,5 @@ export declare class LocationCallbacks { constructor(httpResponse: HttpResponseUtil, locationController: LocationController); getLocationData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocation(url: string, info: IGetLocationRequestData, sessionID: string): IGetBodyResponseData; + getAirdropLoot(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/Live/CWX_DebugTool/types/callbacks/ProfileCallbacks.d.ts b/Live/CWX_DebugTool/types/callbacks/ProfileCallbacks.d.ts index 6a86fc0..183bb0a 100644 --- a/Live/CWX_DebugTool/types/callbacks/ProfileCallbacks.d.ts +++ b/Live/CWX_DebugTool/types/callbacks/ProfileCallbacks.d.ts @@ -1,5 +1,6 @@ import { ProfileController } from "../controllers/ProfileController"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IGetMiniProfileRequestData } from "../models/eft/launcher/IGetMiniProfileRequestData"; @@ -12,20 +13,51 @@ import { ISearchFriendResponse } from "../models/eft/profile/ISearchFriendRespon import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** Handle profile related client events */ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); createProfile(url: string, info: IProfileCreateRequestData, sessionID: string): IGetBodyResponseData; - getProfileData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - regenerateScav(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Get the complete player profile (scav + pmc character) + * @param url + * @param info Empty + * @param sessionID Session id + * @returns Profile object + */ + getProfileData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle the creation of a scav profile for player + * Occurs post-raid and when profile first created immediately after character details are confirmed by player + * @param url + * @param info empty + * @param sessionID Session id + * @returns Profile object + */ + regenerateScav(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/profile/voice/change event + * @param url + * @param info Change voice request object + * @param sessionID Session id + * @returns Client response + */ changeVoice(url: string, info: IProfileChangeVoiceRequestData, sessionID: string): INullResponseData; + /** + * Handle client/game/profile/nickname/change event + * Client allows player to adjust their profile name + * @param url + * @param info Change nickname request object + * @param sessionID Session id + * @returns client response + */ changeNickname(url: string, info: IProfileChangeNicknameRequestData, sessionID: string): IGetBodyResponseData; validateNickname(url: string, info: IValidateNicknameRequestData, sessionID: string): IGetBodyResponseData; getReservedNickname(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** - * Called when creating a character, when you choose a character face/voice + * Called when creating a character when choosing a character face/voice * @param url * @param info response (empty) * @param sessionID diff --git a/Live/CWX_DebugTool/types/callbacks/RagfairCallbacks.d.ts b/Live/CWX_DebugTool/types/callbacks/RagfairCallbacks.d.ts index 3a405c9..c609f2f 100644 --- a/Live/CWX_DebugTool/types/callbacks/RagfairCallbacks.d.ts +++ b/Live/CWX_DebugTool/types/callbacks/RagfairCallbacks.d.ts @@ -19,6 +19,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; +/** + * Handle ragfair related callback events + */ export declare class RagfairCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; protected logger: ILogger; diff --git a/Live/CWX_DebugTool/types/callbacks/RepairCallbacks.d.ts b/Live/CWX_DebugTool/types/callbacks/RepairCallbacks.d.ts index 63733fa..14edeeb 100644 --- a/Live/CWX_DebugTool/types/callbacks/RepairCallbacks.d.ts +++ b/Live/CWX_DebugTool/types/callbacks/RepairCallbacks.d.ts @@ -6,6 +6,20 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa export declare class RepairCallbacks { protected repairController: RepairController; constructor(repairController: RepairController); + /** + * use trader to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + /** + * Use repair kit to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ repair(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/Live/CWX_DebugTool/types/context/ContextVariable.d.ts b/Live/CWX_DebugTool/types/context/ContextVariable.d.ts index e438947..0fe0a63 100644 --- a/Live/CWX_DebugTool/types/context/ContextVariable.d.ts +++ b/Live/CWX_DebugTool/types/context/ContextVariable.d.ts @@ -4,7 +4,7 @@ export declare class ContextVariable { private timestamp; private type; constructor(value: any, type: ContextVariableType); - getValue(): any; + getValue(): T; getTimestamp(): Date; getType(): ContextVariableType; } diff --git a/Live/CWX_DebugTool/types/controllers/BotController.d.ts b/Live/CWX_DebugTool/types/controllers/BotController.d.ts index 5e6f05d..a5111d5 100644 --- a/Live/CWX_DebugTool/types/controllers/BotController.d.ts +++ b/Live/CWX_DebugTool/types/controllers/BotController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotHelper } from "../helpers/BotHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; @@ -5,15 +6,22 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { IBotCore } from "../models/eft/common/tables/IBotCore"; import { Difficulty } from "../models/eft/common/tables/IBotType"; import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; +import { PmcAiService } from "../services/PmcAiService"; export declare class BotController { + protected logger: ILogger; protected databaseServer: DatabaseServer; protected botGenerator: BotGenerator; protected botHelper: BotHelper; + protected pmcAiService: PmcAiService; + protected botGenerationCacheService: BotGenerationCacheService; protected configServer: ConfigServer; + protected applicationContext: ApplicationContext; protected botConfig: IBotConfig; - constructor(databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -29,7 +37,18 @@ export declare class BotController { * @returns Difficulty object */ getBotDifficulty(type: string, difficulty: string): Difficulty; - protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string): Difficulty; + protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Generate bot profiles and store in cache + * @param sessionId Session id + * @param info bot generation request info + * @returns IBotBase array + */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the max number of bots allowed on a map + * Looks up location player is entering when getting cap value + * @returns cap number + */ getBotCap(): number; } diff --git a/Live/CWX_DebugTool/types/controllers/GameController.d.ts b/Live/CWX_DebugTool/types/controllers/GameController.d.ts index d374453..2d00898 100644 --- a/Live/CWX_DebugTool/types/controllers/GameController.d.ts +++ b/Live/CWX_DebugTool/types/controllers/GameController.d.ts @@ -7,11 +7,13 @@ import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; protected localeService: LocaleService; @@ -20,8 +22,12 @@ export declare class GameController { protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + /** + * Make non-trigger-spawned raiders spawn earlier + always + */ + protected adjustLabsRaiderSpawnRate(): void; protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; diff --git a/Live/CWX_DebugTool/types/controllers/InraidController.d.ts b/Live/CWX_DebugTool/types/controllers/InraidController.d.ts index 82bb64d..102a2fb 100644 --- a/Live/CWX_DebugTool/types/controllers/InraidController.d.ts +++ b/Live/CWX_DebugTool/types/controllers/InraidController.d.ts @@ -35,6 +35,30 @@ export declare class InraidController { constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Handle updating the profile post-pmc raid + * @param sessionID session id + * @param offraidData post-raid data of raid + */ + protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Reduce body part hp to % of max + * @param pmcData profile to edit + * @param multipler multipler to apply to max health + */ + protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + /** + * Handle updating the profile post-pscav raid + * @param sessionID session id + * @param offraidData post-raid data of raid + */ + protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Is the player dead after a raid - dead is anything other than "survived" / "runner" + * @param statusOnExit exit value from offraidData object + * @returns true if dead + */ + protected isPlayerDead(statusOnExit: string): boolean; /** * Mark inventory items as FiR if player survived raid, otherwise remove FiR from them * @param offraidData Save Progress Request diff --git a/Live/CWX_DebugTool/types/controllers/InventoryController.d.ts b/Live/CWX_DebugTool/types/controllers/InventoryController.d.ts index f57f731..f564919 100644 --- a/Live/CWX_DebugTool/types/controllers/InventoryController.d.ts +++ b/Live/CWX_DebugTool/types/controllers/InventoryController.d.ts @@ -92,7 +92,11 @@ export declare class InventoryController { */ toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; /** - * Handles Tagging of items (primary Containers). + * Add a tag to an inventory item + * @param pmcData profile with item to add tag to + * @param body tag request data + * @param sessionID session id + * @returns client response object */ tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/Live/CWX_DebugTool/types/controllers/LocationController.d.ts b/Live/CWX_DebugTool/types/controllers/LocationController.d.ts index 90b6d7a..9db3205 100644 --- a/Live/CWX_DebugTool/types/controllers/LocationController.d.ts +++ b/Live/CWX_DebugTool/types/controllers/LocationController.d.ts @@ -1,18 +1,33 @@ import { LocationGenerator } from "../generators/LocationGenerator"; +import { LootGenerator } from "../generators/LootGenerator"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; +import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; +import { LootItem } from "../models/spt/services/LootItem"; import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class LocationController { protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected logger: ILogger; protected locationGenerator: LocationGenerator; + protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; - constructor(jsonUtil: JsonUtil, logger: ILogger, locationGenerator: LocationGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil); + protected configServer: ConfigServer; + protected airdropConfig: IAirdropConfig; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; generateAll(): ILocationsGenerateAllResponse; + /** + * Get loot for an airdop container + * Generates it randomly based on config/airdrop.json values + * @returns Array of LootItem + */ + getAirdropLoot(): LootItem[]; } diff --git a/Live/CWX_DebugTool/types/controllers/MatchController.d.ts b/Live/CWX_DebugTool/types/controllers/MatchController.d.ts index e8585d9..07f6a89 100644 --- a/Live/CWX_DebugTool/types/controllers/MatchController.d.ts +++ b/Live/CWX_DebugTool/types/controllers/MatchController.d.ts @@ -9,13 +9,16 @@ import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestDa import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; +import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { PmcAiService } from "../services/PmcAiService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { protected logger: ILogger; @@ -26,10 +29,13 @@ export declare class MatchController { protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; + protected pmcAiService: PmcAiService; + protected botGenerationCacheService: BotGenerationCacheService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, applicationContext: ApplicationContext); + protected botConfig: IBotConfig; + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/Live/CWX_DebugTool/types/controllers/QuestController.d.ts b/Live/CWX_DebugTool/types/controllers/QuestController.d.ts index 2cbccfb..282f50e 100644 --- a/Live/CWX_DebugTool/types/controllers/QuestController.d.ts +++ b/Live/CWX_DebugTool/types/controllers/QuestController.d.ts @@ -39,16 +39,31 @@ export declare class QuestController { * @returns array of IQuest */ getClientQuests(sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param side player side (usec/bear) + * @param questId questId to check + */ + protected questIsForOtherSide(side: string, questId: string): boolean; + /** + * Handle the client accepting a quest and starting it + * Send starting rewards if any to player and + * Send start notification if any to player + * @param pmcData Profile to update + * @param acceptedQuest Quest accepted + * @param sessionID Session id + * @returns client response + */ acceptQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; acceptRepeatableQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; /** - * Remove completed quest from profile + * Update completed quest in profile * Add newly unlocked quests to profile * Also recalculate thier level due to exp rewards * @param pmcData Player profile - * @param body completed quest request - * @param sessionID session id - * @returns ItemEvent response + * @param body Completed quest request + * @param sessionID Session id + * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -67,10 +82,20 @@ export declare class QuestController { protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the quests provided + * Update quest in profile, otherwise add fresh quest object with failed status * @param sessionID session id * @param pmcData player profile * @param questsToFail quests to fail */ protected failQuests(sessionID: string, pmcData: IPmcData, questsToFail: IQuest[]): void; handoverQuest(pmcData: IPmcData, body: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Increment a backend counter stored value by an amount, + * Create counter if it does not exist + * @param pmcData Profile to find backend counter in + * @param conditionId backend counter id to update + * @param questId quest id counter is associated with + * @param counterValue value to increment the backend counter with + */ + protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; } diff --git a/Live/CWX_DebugTool/types/controllers/RagfairController.d.ts b/Live/CWX_DebugTool/types/controllers/RagfairController.d.ts index c4ffc15..06af740 100644 --- a/Live/CWX_DebugTool/types/controllers/RagfairController.d.ts +++ b/Live/CWX_DebugTool/types/controllers/RagfairController.d.ts @@ -9,6 +9,7 @@ import { RagfairOfferHelper } from "../helpers/RagfairOfferHelper"; import { RagfairSellHelper } from "../helpers/RagfairSellHelper"; import { RagfairSortHelper } from "../helpers/RagfairSortHelper"; import { RagfairTaxHelper } from "../helpers/RagfairTaxHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; @@ -33,6 +34,9 @@ import { RagfairPriceService } from "../services/RagfairPriceService"; import { RagfairRequiredItemsService } from "../services/RagfairRequiredItemsService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** + * Handle RagfairCallback events + */ export declare class RagfairController { protected logger: ILogger; protected timeUtil: TimeUtil; @@ -52,14 +56,20 @@ export declare class RagfairController { protected handbookHelper: HandbookHelper; protected paymentHelper: PaymentHelper; protected inventoryHelper: InventoryHelper; + protected traderHelper: TraderHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected ragfairOfferGenerator: RagfairOfferGenerator; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + /** + * Update a trader flea offer with buy restrictions stored in the traders assort + * @param offer flea offer to update + */ + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer): void; protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; diff --git a/Live/CWX_DebugTool/types/controllers/RepairController.d.ts b/Live/CWX_DebugTool/types/controllers/RepairController.d.ts index 0e78ef6..ae54a53 100644 --- a/Live/CWX_DebugTool/types/controllers/RepairController.d.ts +++ b/Live/CWX_DebugTool/types/controllers/RepairController.d.ts @@ -8,9 +8,9 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa import { IRepairConfig } from "../models/spt/config/IRepairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; -import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { PaymentService } from "../services/PaymentService"; +import { RepairService } from "../services/RepairService"; export declare class RepairController { protected logger: ILogger; protected itemEventRouter: ItemEventRouter; @@ -19,23 +19,23 @@ export declare class RepairController { protected traderHelper: TraderHelper; protected paymentService: PaymentService; protected repairHelper: RepairHelper; - protected configServer: ConfigServer; + protected repairService: RepairService; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); /** * Repair with trader - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + traderRepair(sessionID: string, body: ITraderRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; /** * Repair with repair kit - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - repairWithKit(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + repairWithKit(sessionID: string, body: IRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; } diff --git a/Live/CWX_DebugTool/types/controllers/RepeatableQuestController.d.ts b/Live/CWX_DebugTool/types/controllers/RepeatableQuestController.d.ts index 98d05dd..4c31a3d 100644 --- a/Live/CWX_DebugTool/types/controllers/RepeatableQuestController.d.ts +++ b/Live/CWX_DebugTool/types/controllers/RepeatableQuestController.d.ts @@ -7,6 +7,7 @@ import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; import { TraderInfo } from "../models/eft/common/tables/IBotBase"; import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; import { ELocationName } from "../models/enums/ELocationName"; @@ -15,6 +16,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -64,9 +66,10 @@ export declare class RepeatableQuestController { protected itemEventRouter: ItemEventRouter; protected paymentService: PaymentService; protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. @@ -217,4 +220,16 @@ export declare class RepeatableQuestController { debugLogRepeatableQuestIds(pmcData: IPmcData): void; probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; changeRepeatableQuest(pmcDataIn: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {*} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; } diff --git a/Live/CWX_DebugTool/types/controllers/TraderController.d.ts b/Live/CWX_DebugTool/types/controllers/TraderController.d.ts index 0162064..b79f55e 100644 --- a/Live/CWX_DebugTool/types/controllers/TraderController.d.ts +++ b/Live/CWX_DebugTool/types/controllers/TraderController.d.ts @@ -4,6 +4,7 @@ import { TraderHelper } from "../helpers/TraderHelper"; import { IBarterScheme, ITraderAssort, ITraderBase } from "../models/eft/common/tables/ITrader"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -15,8 +16,9 @@ export declare class TraderController { protected traderHelper: TraderHelper; protected timeUtil: TimeUtil; protected traderAssortService: TraderAssortService; + protected fenceService: FenceService; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, fenceService: FenceService, jsonUtil: JsonUtil); /** * Runs when onLoad event is fired * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService @@ -26,6 +28,7 @@ export declare class TraderController { /** * Runs when onUpdate is fired * If current time is > nextResupply(expire) time of trader, refresh traders assorts and + * Fence is handled slightly differently * @returns has run */ update(): boolean; diff --git a/Live/CWX_DebugTool/types/di/Container.d.ts b/Live/CWX_DebugTool/types/di/Container.d.ts index 17791b0..98d1fa1 100644 --- a/Live/CWX_DebugTool/types/di/Container.d.ts +++ b/Live/CWX_DebugTool/types/di/Container.d.ts @@ -1,4 +1,7 @@ import { DependencyContainer } from "tsyringe"; +/** + * Handle the registration of classes to be used by the Dependency Injection code + */ export declare class Container { static registerTypes(depContainer: DependencyContainer): void; static registerListTypes(depContainer: DependencyContainer): void; diff --git a/Live/CWX_DebugTool/types/generators/BotGenerator.d.ts b/Live/CWX_DebugTool/types/generators/BotGenerator.d.ts index a5fc0ad..2ac51db 100644 --- a/Live/CWX_DebugTool/types/generators/BotGenerator.d.ts +++ b/Live/CWX_DebugTool/types/generators/BotGenerator.d.ts @@ -9,6 +9,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { PmcAiService } from "../services/PmcAiService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -30,9 +31,10 @@ export declare class BotGenerator { protected botEquipmentFilterService: BotEquipmentFilterService; protected botHelper: BotHelper; protected gameEventHelper: GameEventHelper; + protected pmcAiService: PmcAiService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, pmcAiService: PmcAiService, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -40,14 +42,14 @@ export declare class BotGenerator { * @param botTemplate base bot template to use (e.g. assault/pmcbot) * @returns */ - generatePlayerScav(role: string, difficulty: string, botTemplate: IBotType): IBotBase; - generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Choose if a bot should become a PMC by checking if bot type is allowed to become a Pmc in botConfig.convertFromChances and doing a random int check - * @param botRole the bot role to check if should be a pmc - * @returns true if should be a pmc + * Generate an array of bot objects for populate a raid with + * @param sessionId session id + * @param info request object + * @returns bot array */ - protected shouldBotBePmc(botRole: string): boolean; + generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** * Get a randomised PMC side based on bot config value 'isUsec' * @returns pmc side as string @@ -58,12 +60,30 @@ export declare class BotGenerator { * @returns IBotBase object */ protected getCloneOfBotBase(): IBotBase; - protected generateBot(bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + /** + * Create a IBotBase object with equipment/loot/exp etc + * @param sessionId Session id + * @param bot bots base file + * @param role botRole bot will use + * @param node Bot template from db/bots/x.json + * @param isPmc Is bot to be a PMC + * @param isPlayerScav is bot to be a p scav bot + * @returns IBotBase object + */ + protected generateBot(sessionId: string, bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; /** * Log the number of PMCs generated to the debug console + * @param output Generated bot array, ready to send to client */ protected logPmcGeneratedCount(output: IBotBase[]): void; - protected generateRandomLevel(min: number, max: number): BotGenerator.IRandomisedBotLevelResult; + /** + * Return a randomised bot level and exp value + * @param role botRole being generated for + * @param min Min exp value + * @param max Max exp value + * @returns IRandomisedBotLevelResult object + */ + protected generateRandomLevel(role: string, min: number, max: number): BotGenerator.IRandomisedBotLevelResult; /** * Converts health object to the required format * @param healthObj health object from bot json @@ -72,19 +92,23 @@ export declare class BotGenerator { */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; protected generateSkills(skillsObj: Skills): Skills; - /** - * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) - * @param pmcSide eft side (usec/bear) - * @returns pmc side as defined in config - */ - protected getPmcRole(pmcSide: string): string; /** * Iterate through bots inventory and loot to find and remove christmas items (as defined in GameEventHelper) * @param nodeInventory Bots inventory to iterate over */ protected removeChristmasItemsFromBotInventory(nodeInventory: Inventory): void; + /** + * Generate a random Id for a bot and apply to bots _id and aid value + * @param bot bot to update + * @returns updated IBotBase object + */ protected generateId(bot: IBotBase): IBotBase; protected generateInventoryID(profile: IBotBase): IBotBase; + /** + * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * @param requestedDifficulty + * @returns + */ protected getPMCDifficulty(requestedDifficulty: string): string; /** * Add a side-specific (usec/bear) dogtag item to a bots inventory diff --git a/Live/CWX_DebugTool/types/generators/BotInventoryGenerator.d.ts b/Live/CWX_DebugTool/types/generators/BotInventoryGenerator.d.ts index 35d1ee8..c5ed545 100644 --- a/Live/CWX_DebugTool/types/generators/BotInventoryGenerator.d.ts +++ b/Live/CWX_DebugTool/types/generators/BotInventoryGenerator.d.ts @@ -1,13 +1,16 @@ +import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Inventory, Chances, Generation, Mods } from "../models/eft/common/tables/IBotType"; +import { Chances, Generation, Inventory, Mods } from "../models/eft/common/tables/IBotType"; +import { EquipmentSlots } from "../models/enums/EquipmentSlots"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; -import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; -import { BotWeaponGenerator } from "./BotWeaponGenerator"; import { BotLootGenerator } from "./BotLootGenerator"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; +import { BotWeaponGenerator } from "./BotWeaponGenerator"; export declare class BotInventoryGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -17,8 +20,14 @@ export declare class BotInventoryGenerator { protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper); - generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { + slot: EquipmentSlots; + shouldSpawn: boolean; + }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; protected generateInventoryBase(): PmcInventory; } diff --git a/Live/CWX_DebugTool/types/generators/BotLootGenerator.d.ts b/Live/CWX_DebugTool/types/generators/BotLootGenerator.d.ts index c6a3f29..c1f5310 100644 --- a/Live/CWX_DebugTool/types/generators/BotLootGenerator.d.ts +++ b/Live/CWX_DebugTool/types/generators/BotLootGenerator.d.ts @@ -1,4 +1,5 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; @@ -20,11 +21,12 @@ export declare class BotLootGenerator { protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botLootCacheService: BotLootCacheService, configServer: ConfigServer); - generateLoot(templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer); + generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached @@ -47,7 +49,7 @@ export declare class BotLootGenerator { * @param botRole bots role, .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; /** * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from diff --git a/Live/CWX_DebugTool/types/generators/BotWeaponGenerator.d.ts b/Live/CWX_DebugTool/types/generators/BotWeaponGenerator.d.ts index 9215214..487901b 100644 --- a/Live/CWX_DebugTool/types/generators/BotWeaponGenerator.d.ts +++ b/Live/CWX_DebugTool/types/generators/BotWeaponGenerator.d.ts @@ -1,4 +1,5 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { MinMax } from "../models/common/MinMax"; @@ -14,6 +15,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { IInventoryMagGen } from "./weapongen/IInventoryMagGen"; export declare class BotWeaponGenerator { protected jsonUtil: JsonUtil; protected logger: ILogger; @@ -24,11 +26,24 @@ export declare class BotWeaponGenerator { protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; protected configServer: ConfigServer; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, inventoryMagGenComponents: IInventoryMagGen[]); /** - * Get a random weapon from a bots pool of weapons (weighted) + * Pick a random weapon based on weightings and generate a functional weapon + * @param equipmentSlot Primary/secondary/holster + * @param botTemplateInventory e.g. assault.json + * @param weaponParentId + * @param modChances + * @param botRole role of bot, e.g. assault/followerBully + * @param isPmc Is weapon generated for a pmc + * @returns GenerateWeaponResult object + */ + generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + /** + * Get a random weighted weapon from a bots pool of weapons * @param equipmentSlot Primary/secondary/holster * @param botTemplateInventory e.g. assault.json * @returns weapon tpl @@ -39,43 +54,24 @@ export declare class BotWeaponGenerator { * @param weaponTpl weapon tpl to generate (use pickWeightedWeaponTplFromPool()) * @param equipmentSlot slot to fit into, primary/secondary/holster * @param botTemplateInventory e.g. assault.json - * @param weaponParentId - * @param modChances - * @param botRole + * @param weaponParentId ParentId of the weapon being generated + * @param modChances Dictionary of item types and % chance weapon will have that mod + * @param botRole e.g. assault/exusec * @param isPmc * @returns GenerateWeaponResult object */ - generateWeaponByTpl(weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; /** - * Generate an entirely random weapon - * @param equipmentSlot Primary/secondary/holster - * @param botTemplateInventory e.g. assault.json - * @param weaponParentId - * @param modChances - * @param botRole - * @param isPmc - * @returns GenerateWeaponResult object - */ - generateRandomWeapon(equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; - /** - * Create array with weapon base as only element - * Add additional properties as required - * @param weaponTpl - * @param weaponParentId - * @param equipmentSlot - * @param weaponItemTemplate + * Create array with weapon base as only element and + * add additional properties based on weapon type + * @param weaponTpl Weapon tpl to create item with + * @param weaponParentId Weapons parent id + * @param equipmentSlot e.g. primary/secondary/holster + * @param weaponItemTemplate db template for weapon * @param botRole for durability values - * @returns + * @returns Base weapon item in array */ - constructWeaponBaseArray(weaponTpl: string, weaponParentId: string, equipmentSlot: string, weaponItemTemplate: ITemplateItem, botRole: string): Item[]; - /** - * Add compatible magazines to an inventory based on a generated weapon - * @param weaponDetails - * @param magCounts - * @param inventory - * @param botRole the bot type we're getting generating extra mags for - */ - addExtraMagazinesToInventory(weaponDetails: GenerateWeaponResult, magCounts: MinMax, inventory: PmcInventory, botRole: string): void; + protected constructWeaponBaseArray(weaponTpl: string, weaponParentId: string, equipmentSlot: string, weaponItemTemplate: ITemplateItem, botRole: string): Item[]; /** * Get the mods necessary to kit out a weapon to its preset level * @param weaponTpl weapon to find preset for @@ -84,33 +80,21 @@ export declare class BotWeaponGenerator { * @returns array of weapon mods */ protected getPresetWeaponMods(weaponTpl: string, equipmentSlot: string, weaponParentId: string, itemTemplate: ITemplateItem, botRole: string): Item[]; - /** Checks if all required slots are occupied on a weapon and all it's mods */ + /** + * Checks if all required slots are occupied on a weapon and all it's mods + * @param weaponItemArray Weapon + mods + * @returns true if valid + */ protected isWeaponValid(weaponItemArray: Item[]): boolean; /** * Generates extra magazines or bullets (if magazine is internal) and adds them to TacticalVest and Pockets. * Additionally, adds extra bullets to SecuredContainer - * @param weaponMods - * @param weaponTemplate - * @param magCounts - * @param ammoTpl - * @param inventory - * @param botRole the bot type we're getting generating extra mags for - * @returns + * @param generatedWeaponResult object with properties for generated weapon (weapon mods pool / weapon template / ammo tpl) + * @param magCounts Magazine count to add to inventory + * @param inventory Inventory to add magazines to + * @param botRole The bot type we're getting generating extra mags for */ - protected generateExtraMagazines(weaponMods: Item[], weaponTemplate: ITemplateItem, magCounts: MinMax, ammoTpl: string, inventory: PmcInventory, botRole: string): void; - /** - * Get a randomised number of bullets for a specific magazine - * @param magCounts min and max count of magazines - * @param magTemplate magazine to generate bullet count for - * @returns bullet count number - */ - protected getRandomisedBulletCount(magCounts: MinMax, magTemplate: ITemplateItem): number; - /** - * Get a randomised count of magazines - * @param magCounts min and max value returned value can be between - * @returns numberical value of magazine count - */ - protected getRandomisedMagazineCount(magCounts: MinMax): number; + addExtraMagazinesToInventory(generatedWeaponResult: GenerateWeaponResult, magCounts: MinMax, inventory: PmcInventory, botRole: string): void; /** * Add ammo to the secure container * @param stackCount How many stacks of ammo to add @@ -127,21 +111,13 @@ export declare class BotWeaponGenerator { * @returns magazine tpl string */ protected getMagazineTplFromWeaponTemplate(weaponMods: Item[], weaponTemplate: ITemplateItem, botRole: string): string; - /** - * Get a weapons default magazine template id - * @param weaponTemplate weapon to get default magazine for - * @returns tpl of magazine - */ - protected getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - protected addBulletsToVestAndPockets(ammoTpl: string, bulletCount: number, inventory: PmcInventory): void; /** * Finds and return a compatible ammo tpl based on the bots ammo weightings (x.json/inventory/equipment/ammo) * @param ammo a list of ammo tpls the weapon can use * @param weaponTemplate the weapon we want to pick ammo for - * @param isPmc is the ammo being gathered for a pmc (runs pmc ammo filtering) * @returns an ammo tpl that works with the desired gun */ - protected getCompatibleAmmo(ammo: Record>, weaponTemplate: ITemplateItem, isPmc: boolean): string; + protected getWeightedCompatibleAmmo(ammo: Record>, weaponTemplate: ITemplateItem): string; /** * Get a weapons compatible cartridge caliber * @param weaponTemplate Weapon to look up caliber of diff --git a/Live/CWX_DebugTool/types/generators/LocationGenerator.d.ts b/Live/CWX_DebugTool/types/generators/LocationGenerator.d.ts index bd368b5..cc61dcf 100644 --- a/Live/CWX_DebugTool/types/generators/LocationGenerator.d.ts +++ b/Live/CWX_DebugTool/types/generators/LocationGenerator.d.ts @@ -3,10 +3,9 @@ import { GameEventHelper } from "../helpers/GameEventHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; -import { ILooseLoot, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; +import { ILooseLoot, SpawnpointsForced, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; import { Item } from "../models/eft/common/tables/IItem"; import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticLootDetails } from "../models/eft/common/tables/ILootBase"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -36,11 +35,19 @@ export declare class LocationGenerator { generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; + /** + * Create array of loose + forced loot using probability system + * @param dynamicLootDist + * @param staticAmmoDist + * @param locationName Location to generate loot for + * @returns Array of spawn points with loot in them + */ generateDynamicLoot(dynamicLootDist: ILooseLoot, staticAmmoDist: Record, locationName: string): SpawnpointTemplate[]; + /** + * Add forced spawn point loot into loot parameter array + * @param loot array to add forced loot to + * @param forcedSpawnPoints forced loot to add + */ + protected addForcedLoot(loot: SpawnpointTemplate[], forcedSpawnPoints: SpawnpointsForced[]): void; protected createItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; - protected getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; - protected getRandomValidCaliber(magTemplate: ITemplateItem): string; - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; - protected createRandomMagCartridges(magTemplate: ITemplateItem, parentId: string, staticAmmoDist: Record, caliber?: string): Item; - protected createCartidges(parentId: string, ammoTpl: string, stackCount: number): Item; } diff --git a/Live/CWX_DebugTool/types/generators/LootGenerator.d.ts b/Live/CWX_DebugTool/types/generators/LootGenerator.d.ts new file mode 100644 index 0000000..bbc1915 --- /dev/null +++ b/Live/CWX_DebugTool/types/generators/LootGenerator.d.ts @@ -0,0 +1,58 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Preset } from "../models/eft/common/IGlobals"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { LootItem } from "../models/spt/services/LootItem"; +import { LootRequest } from "../models/spt/services/LootRequest"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { HashUtil } from "../utils/HashUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class LootGenerator { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected databaseServer: DatabaseServer; + protected randomUtil: RandomUtil; + protected itemHelper: ItemHelper; + protected itemFilterService: ItemFilterService; + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, itemFilterService: ItemFilterService); + /** + * Generate a list of items based on options passed in + * @param options parameters to adjust what loot is generated + * @returns An array of loot items + */ + createRandomloot(options: LootRequest): LootItem[]; + /** + * Construct item limit record to hold max and current item count + * @param limits limits as defined in config + * @returns record, key: item tplId, value: current/max item count allowed + */ + protected initItemLimitCounter(limits: Record): Record; + /** + * Find a random item in items.json and add to result array + * @param items items to choose from + * @param itemTypeCounts item limit counts + * @param options item filters + * @param result array to add found item to + * @returns true if item was valid and added to pool + */ + protected findAndAddRandomItemToLoot(items: [string, ITemplateItem][], itemTypeCounts: Record, options: LootRequest, result: LootItem[]): boolean; + /** + * + * Find a random item in items.json and add to result array + * @param globalDefaultPresets presets to choose from + * @param itemTypeCounts item limit counts + * @param result array to add found preset to + * @returns true if preset was valid and added to pool + */ + protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, Preset][], itemTypeCounts: Record, result: LootItem[]): boolean; +} diff --git a/Live/CWX_DebugTool/types/generators/PMCLootGenerator.d.ts b/Live/CWX_DebugTool/types/generators/PMCLootGenerator.d.ts index 64e6f7f..b9f2a83 100644 --- a/Live/CWX_DebugTool/types/generators/PMCLootGenerator.d.ts +++ b/Live/CWX_DebugTool/types/generators/PMCLootGenerator.d.ts @@ -1,15 +1,21 @@ import { ItemHelper } from "../helpers/ItemHelper"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ConfigServer } from "../servers/ConfigServer"; import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +/** + * Handle the generation of dynamic PMC loot in pockets and backpacks + * and the removal of blacklisted items + */ export declare class PMCLootGenerator { protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; + protected itemFilterService: ItemFilterService; protected pocketLootPool: string[]; protected backpackLootPool: string[]; protected botConfig: IBotConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService); generatePMCPocketLootPool(): string[]; generatePMCBackpackLootPool(): string[]; } diff --git a/Live/CWX_DebugTool/types/generators/RagfairAssortGenerator.d.ts b/Live/CWX_DebugTool/types/generators/RagfairAssortGenerator.d.ts index cbdd7f2..db4811d 100644 --- a/Live/CWX_DebugTool/types/generators/RagfairAssortGenerator.d.ts +++ b/Live/CWX_DebugTool/types/generators/RagfairAssortGenerator.d.ts @@ -1,5 +1,8 @@ import { ItemHelper } from "../helpers/ItemHelper"; +import { Preset } from "../models/eft/common/IGlobals"; import { Item } from "../models/eft/common/tables/IItem"; +import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -8,18 +11,40 @@ export declare class RagfairAssortGenerator { protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; protected generatedAssortItems: Item[]; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer); + protected ragfairConfig: IRagfairConfig; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); /** * Get an array of unique items that can be sold on the flea * @returns array of unique items */ getAssortItems(): Item[]; + /** + * Check internal generatedAssortItems array has objects + * @returns true if array has objects + */ protected assortsAreGenerated(): boolean; /** * Generate an array of items the flea can sell * @returns array of unique items */ protected generateRagfairAssortItems(): Item[]; + /** + * Get presets from globals.json + * @returns Preset object array + */ + protected getPresets(): Preset[]; + /** + * Get default presets from globals.json + * @returns Preset object array + */ + protected getDefaultPresets(): Preset[]; + /** + * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true + * @param tplId tplid to add to item + * @param id id to add to item + * @returns hydrated Item object + */ protected createRagfairAssortItem(tplId: string, id?: string): Item; } diff --git a/Live/CWX_DebugTool/types/generators/ScavCaseRewardGenerator.d.ts b/Live/CWX_DebugTool/types/generators/ScavCaseRewardGenerator.d.ts index c7d6ab7..89cb5c8 100644 --- a/Live/CWX_DebugTool/types/generators/ScavCaseRewardGenerator.d.ts +++ b/Live/CWX_DebugTool/types/generators/ScavCaseRewardGenerator.d.ts @@ -8,9 +8,13 @@ import { RewardCountAndPriceDetails, ScavCaseRewardCountsAndPrices } from "../mo import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { RagfairPriceService } from "../services/RagfairPriceService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +/** + * Handle the creation of randomised scav case rewards + */ export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; @@ -18,9 +22,10 @@ export declare class ScavCaseRewardGenerator { protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param body client request diff --git a/Live/CWX_DebugTool/types/generators/WeatherGenerator.d.ts b/Live/CWX_DebugTool/types/generators/WeatherGenerator.d.ts index 44cecbb..8ddbe49 100644 --- a/Live/CWX_DebugTool/types/generators/WeatherGenerator.d.ts +++ b/Live/CWX_DebugTool/types/generators/WeatherGenerator.d.ts @@ -1,7 +1,7 @@ import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { ConfigServer } from "../servers/ConfigServer"; import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class WeatherGenerator { @@ -21,11 +21,16 @@ export declare class WeatherGenerator { protected getAcceleratedTime(computedDate: Date): string; /** * Get current time formatted to fit BSGs requirement - * @param computedDate + * @param computedDate date to format into bsg style * @returns */ protected getNormalTime(computedDate: Date): string; - generateWeather(data: IWeatherData): IWeatherData; + /** + * Return randomised Weather data + * @param weatherData weather input data + * @returns Randomised weather data + */ + generateWeather(weatherData: IWeatherData): IWeatherData; protected getWeightedFog(): string; protected getWeightedRain(): number; protected getRandomFloat(node: string): number; diff --git a/Live/CWX_DebugTool/types/generators/weapongen/IInventoryMagGen.d.ts b/Live/CWX_DebugTool/types/generators/weapongen/IInventoryMagGen.d.ts new file mode 100644 index 0000000..792f510 --- /dev/null +++ b/Live/CWX_DebugTool/types/generators/weapongen/IInventoryMagGen.d.ts @@ -0,0 +1,6 @@ +import { InventoryMagGen } from "./InventoryMagGen"; +export interface IInventoryMagGen { + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_DebugTool/types/generators/weapongen/InventoryMagGen.d.ts b/Live/CWX_DebugTool/types/generators/weapongen/InventoryMagGen.d.ts new file mode 100644 index 0000000..30bf79f --- /dev/null +++ b/Live/CWX_DebugTool/types/generators/weapongen/InventoryMagGen.d.ts @@ -0,0 +1,16 @@ +import { MinMax } from "../../models/common/MinMax"; +import { Inventory } from "../../models/eft/common/tables/IBotBase"; +import { ITemplateItem } from "../../models/eft/common/tables/ITemplateItem"; +export declare class InventoryMagGen { + private magCounts; + private magazineTemplate; + private weaponTemplate; + private ammoTemplate; + private pmcInventory; + constructor(magCounts: MinMax, magazineTemplate: ITemplateItem, weaponTemplate: ITemplateItem, ammoTemplate: ITemplateItem, pmcInventory: Inventory); + getMagCount(): MinMax; + getMagazineTemplate(): ITemplateItem; + getWeaponTemplate(): ITemplateItem; + getAmmoTemplate(): ITemplateItem; + getPmcInventory(): Inventory; +} diff --git a/Live/CWX_DebugTool/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts b/Live/CWX_DebugTool/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts new file mode 100644 index 0000000..b754d5f --- /dev/null +++ b/Live/CWX_DebugTool/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts @@ -0,0 +1,12 @@ +import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; +import { RandomUtil } from "../../../utils/RandomUtil"; +import { IInventoryMagGen } from "../IInventoryMagGen"; +import { InventoryMagGen } from "../InventoryMagGen"; +export declare class BarrelInventoryMagGen implements IInventoryMagGen { + protected randomUtil: RandomUtil; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + constructor(randomUtil: RandomUtil, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_DebugTool/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/Live/CWX_DebugTool/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts new file mode 100644 index 0000000..4fcb1e2 --- /dev/null +++ b/Live/CWX_DebugTool/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -0,0 +1,14 @@ +import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; +import { ItemHelper } from "../../../helpers/ItemHelper"; +import { ILogger } from "../../../models/spt/utils/ILogger"; +import { IInventoryMagGen } from "../IInventoryMagGen"; +import { InventoryMagGen } from "../InventoryMagGen"; +export declare class ExternalInventoryMagGen implements IInventoryMagGen { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + constructor(logger: ILogger, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_DebugTool/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts b/Live/CWX_DebugTool/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts new file mode 100644 index 0000000..4548a04 --- /dev/null +++ b/Live/CWX_DebugTool/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts @@ -0,0 +1,10 @@ +import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; +import { IInventoryMagGen } from "../IInventoryMagGen"; +import { InventoryMagGen } from "../InventoryMagGen"; +export declare class InternalMagazineInventoryMagGen implements IInventoryMagGen { + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + constructor(botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_DebugTool/types/helpers/AssortHelper.d.ts b/Live/CWX_DebugTool/types/helpers/AssortHelper.d.ts index 15586b9..bfc157f 100644 --- a/Live/CWX_DebugTool/types/helpers/AssortHelper.d.ts +++ b/Live/CWX_DebugTool/types/helpers/AssortHelper.d.ts @@ -17,7 +17,7 @@ export declare class AssortHelper { * @param assort assort items from a trader * @returns assort items minus locked quest assorts */ - stripLockedQuestAssort(pmcProfile: IPmcData, traderId: string, assort: ITraderAssort): ITraderAssort; + stripLockedQuestAssort(pmcProfile: IPmcData, traderId: string, assort: ITraderAssort, flea?: boolean): ITraderAssort; /** * Remove assorts from a trader that have not been unlocked yet * @param pmcProfile player profile @@ -32,5 +32,5 @@ export declare class AssortHelper { * @param itemID item id to remove from asort * @returns Modified assort */ - removeItemFromAssort(assort: ITraderAssort, itemID: string): ITraderAssort; + removeItemFromAssort(assort: ITraderAssort, itemID: string, flea?: boolean): ITraderAssort; } diff --git a/Live/CWX_DebugTool/types/helpers/BotGeneratorHelper.d.ts b/Live/CWX_DebugTool/types/helpers/BotGeneratorHelper.d.ts index 3cd7256..5e3e501 100644 --- a/Live/CWX_DebugTool/types/helpers/BotGeneratorHelper.d.ts +++ b/Live/CWX_DebugTool/types/helpers/BotGeneratorHelper.d.ts @@ -1,19 +1,33 @@ import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper"; -import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem"; -import { Grid, ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { ItemFilterService } from "../services/ItemFilterService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotWeaponGeneratorHelper } from "./BotWeaponGeneratorHelper"; import { ContainerHelper } from "./ContainerHelper"; import { InventoryHelper } from "./InventoryHelper"; import { ItemHelper } from "./ItemHelper"; import { ProbabilityHelper } from "./ProbabilityHelper"; +import { ProfileHelper } from "./ProfileHelper"; +export declare class BotModLimits { + scope: ItemCount; + scopeMax: number; + scopeBaseTypes: string[]; + flashlightLaser: ItemCount; + flashlightLaserMax: number; + flashlgihtLaserBaseTypes: string[]; +} +export declare class ItemCount { + count: number; +} export declare class BotGeneratorHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -25,16 +39,121 @@ export declare class BotGeneratorHelper { protected itemHelper: ItemHelper; protected inventoryHelper: InventoryHelper; protected containerHelper: ContainerHelper; + protected botEquipmentFilterService: BotEquipmentFilterService; + protected itemFilterService: ItemFilterService; + protected profileHelper: ProfileHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, configServer: ConfigServer); - generateModsForItem(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, configServer: ConfigServer); /** - * Is this magazine cylinder related (revolvers and grenade launchers) - * @param magazineParentName the name of the magazines parent - * @returns true if it is cylinder related + * Check mods are compatible and add to array + * @param equipment Equipment item to add mods to + * @param modPool Mod list to choose frm + * @param parentId parentid of item to add mod to + * @param parentTemplate template objet of item to add mods to + * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @returns Item + compatible mods as an array */ - magazineIsCylinderRelated(magazineParentName: string): boolean; + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + /** + * @param sessionId session id + * @param weapon Weapon to add mods to + * @param modPool Pool of compatible mods to attach to weapon + * @param weaponParentId parentId of weapon + * @param parentWeaponTemplate Weapon which mods will be generated on + * @param modSpawnChances Mod spawn chances + * @param ammoTpl Ammo tpl to use when generating magazines/cartridges + * @param botRole Role of bot weapon is generated for + * @returns Weapon + mods array + */ + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; + /** + * + * @param modSlot + * @param isRandomisableSlot + * @param modsParent + * @param botEquipBlacklist + * @param itemModPool + * @param weapon array with only weapon tpl in it, ready for mods to be added + * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) + * @param parentTemplate + * @returns + */ + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + /** + * Find mod tpls of a provided type and add to modPool + * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) + * @param modTemplate db object for modItem we get compatible mods from + * @param modPool Pool of mods we are adding to + */ + protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; + /** + * Check if mod item is on limited list + has surpassed the limit set for it + * @param botRole role the bot has e.g. assault + * @param modTemplate mods template data + * @param modLimits limits set for weapon being generated for this bot + * @returns true if over item limit + */ + protected modHasReachedItemLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits): boolean; + /** + * Initalise mod limits to be used when generating a weapon + * @param botRole "assault", "bossTagilla" or "pmc" + * @returns BotModLimits object + */ + protected initModLimits(botRole: string): BotModLimits; + /** + * Generate a pool of mods for this bots mod type if bot has values inside `randomisedWeaponModSlots` array found in bot.json/equipment[botrole] + * @param allowedMods Mods to be added to mod pool + * @param botEquipBlacklist blacklist of items not allowed to be added to mod pool + * @param modSlot Slot to generate mods for + * @param itemModPool base mod pool to replace values of + */ + protected generateDynamicWeaponModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record): void; + /** + * Find all compatible mods for equipment item and add to modPool + * @param itemDetails item to find mods for + * @param modPool ModPool to add mods to + */ + generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods): void; + /** + * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist + * @param allowedMods base mods to filter + * @param botEquipBlacklist equipment blacklist + * @param modSlot slot mods belong to + * @returns Filtered array of mod tpls + */ + protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; + /** + * Check if the specific item type on the weapon has reached the set limit + * @param modTpl log mod tpl if over type limit + * @param currentCount current number of this item on gun + * @param maxLimit mod limit allowed + * @param botRole role of bot we're checking weapon of + * @returns true if limit reached + */ + protected weaponModLimitReached(modTpl: string, currentCount: { + count: number; + }, maxLimit: number, botRole: string): boolean; + /** + * Log errors if mod is not compatible with slot + * @param modToAdd template of mod to check + * @param itemSlot slot the item will be placed in + * @param modSlot slot the mod will fill + * @param parentTemplate tempalte of the mods parent item + * @returns true if valid + */ + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + /** + * Create a mod item with parameters as properties + * @param modId _id + * @param modTpl _tpl + * @param parentId parentId + * @param modSlot slotId + * @param modTemplate Used to add additional properites in the upd object + * @returns Item object + */ + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem): Item; /** * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance @@ -46,7 +165,7 @@ export declare class BotGeneratorHelper { protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; /** * Get a list of containers that hold ammo - * e.g. mod_magazine + * e.g. mod_magazine / patron_in_weapon_000 * @returns string array */ protected getAmmoContainers(): string[]; @@ -62,11 +181,11 @@ export declare class BotGeneratorHelper { * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" - * - * @param {object} items The items where the CylinderMagazine's camora are appended to - * @param {object} modPool modPool which should include available cartrigdes - * @param {string} parentId The CylinderMagazine's UID - * @param {object} parentTemplate The CylinderMagazine's template + * @param items The items where the CylinderMagazine's camora are appended to + * @param modPool modPool which should include available cartrigdes + * @param parentId The CylinderMagazine's UID + * @param parentTemplate The CylinderMagazine's template + * @returns */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** @@ -75,6 +194,13 @@ export declare class BotGeneratorHelper { * @returns string array of shells fro luitple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + /** + * Adds properties to an item + * e.g. Repairable / HasHinge / Foldable / MaxDurability + * @param itemTemplate + * @param botRole Used by weapons to randomise the durability values + * @returns Item Upd object with extra properties + */ generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { upd?: Upd; }; @@ -92,13 +218,15 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; - protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** - * Sort by spawn chance, highest to lowest, higher is more common - * @param unsortedModArray String array to sort - * @returns Sorted string array + * Get a random mod from an items compatible mods Filter array + * @param modTpl + * @param parentSlot + * @param modSlot + * @param items + * @returns item tpl */ - protected sortModArray(unsortedModArray: string[]): string[]; + protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** * Can an item be added to an item without issue * @param items @@ -107,18 +235,8 @@ export declare class BotGeneratorHelper { * @returns true if possible */ isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; - /** - * Adds an item with all its childern into specified equipmentSlots, wherever it fits. - * @param equipmentSlots - * @param parentId - * @param parentTpl - * @param itemWithChildren - * @param inventory - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: PmcInventory): boolean; - protected itemAllowedInContainer(slot: Grid, itemTpl: string): boolean; } +/** TODO - move into own class */ export declare class ExhaustableArray { private itemPool; private randomUtil; diff --git a/Live/CWX_DebugTool/types/helpers/BotHelper.d.ts b/Live/CWX_DebugTool/types/helpers/BotHelper.d.ts index 9b89481..18738e5 100644 --- a/Live/CWX_DebugTool/types/helpers/BotHelper.d.ts +++ b/Live/CWX_DebugTool/types/helpers/BotHelper.d.ts @@ -13,11 +13,34 @@ export declare class BotHelper { protected configServer: ConfigServer; protected botConfig: IBotConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, configServer: ConfigServer); + /** + * Get difficulty settings for desired bot type, if not found use assault bot types + * @param type bot type to retreive difficulty of + * @param difficulty difficulty to get settings for (easy/normal etc) + * @returns Difficulty object + */ getBotDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Get a template object for the specified botRole from bots.types db + * @param role botRole to get template for + * @returns IBotType object + */ getBotTemplate(role: string): IBotType; + /** + * Get difficulty settings for a PMC + * @param type "usec" / "bear" + * @param difficulty what difficulty to retrieve + * @returns Difficulty object + */ getPmcDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Choose a random difficulty from - easy/normal/hard/impossible + * @returns random difficulty + */ + chooseRandomDifficulty(): string; /** * Randomise the chance the PMC will attack their own side + * Look up value in bot.json/chanceSameSideIsHostilePercent * @param difficultySettings pmc difficulty settings */ randomisePmcHostility(difficultySettings: Difficulty): void; @@ -31,7 +54,7 @@ export declare class BotHelper { */ addBotToFriendlyList(difficultySettings: Difficulty, typeToAdd: string): void; /** - * Add a bot to the ENEMY_BOT_TYPES array + * Add a bot to the ENEMY_BOT_TYPES array, do not add itself if its on the enemy list * @param difficultySettings bot settings to alter * @param typesToAdd bot type to add to enemy list */ @@ -42,4 +65,10 @@ export declare class BotHelper { * @param typesToAdd bot type to add to revenge list */ addBotToRevengeList(difficultySettings: Difficulty, typesToAdd: string[]): void; + /** + * Choose if a bot should become a PMC by checking if bot type is allowed to become a Pmc in botConfig.convertFromChances and doing a random int check + * @param botRole the bot role to check if should be a pmc + * @returns true if should be a pmc + */ + shouldBotBePmc(botRole: string): boolean; } diff --git a/Live/CWX_DebugTool/types/helpers/BotWeaponGeneratorHelper.d.ts b/Live/CWX_DebugTool/types/helpers/BotWeaponGeneratorHelper.d.ts new file mode 100644 index 0000000..7e25f56 --- /dev/null +++ b/Live/CWX_DebugTool/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -0,0 +1,78 @@ +import { MinMax } from "../models/common/MinMax"; +import { Inventory } from "../models/eft/common/tables/IBotBase"; +import { Item } from "../models/eft/common/tables/IItem"; +import { Grid, ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { HashUtil } from "../utils/HashUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { ContainerHelper } from "./ContainerHelper"; +import { InventoryHelper } from "./InventoryHelper"; +import { ItemHelper } from "./ItemHelper"; +export declare class BotWeaponGeneratorHelper { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper); + /** + * Get a randomised number of bullets for a specific magazine + * @param magCounts min and max count of magazines + * @param magTemplate magazine to generate bullet count for + * @returns bullet count number + */ + getRandomisedBulletCount(magCounts: MinMax, magTemplate: ITemplateItem): number; + /** + * Get a randomised count of magazines + * @param magCounts min and max value returned value can be between + * @returns numberical value of magazine count + */ + getRandomisedMagazineCount(magCounts: MinMax): number; + /** + * Is this magazine cylinder related (revolvers and grenade launchers) + * @param magazineParentName the name of the magazines parent + * @returns true if it is cylinder related + */ + magazineIsCylinderRelated(magazineParentName: string): boolean; + /** + * Create a magazine using the parameters given + * @param magazineTpl Tpl of the magazine to create + * @param ammoTpl Ammo to add to magazine + * @param magTemplate template object of magazine + * @returns Item array + */ + createMagazine(magazineTpl: string, ammoTpl: string, magTemplate: ITemplateItem): Item[]; + /** + * Add a specific number of cartrdiges to a bots inventory (vest/pocket) + * @param ammoTpl Ammo tpl to add to vest/pockets + * @param cartridgeCount number of cartridges to add to vest/pockets + * @param inventory bot inventory to add cartridges to + */ + addBulletsToVestAndPockets(ammoTpl: string, cartridgeCount: number, inventory: Inventory): void; + /** + * Get a weapons default magazine template id + * @param weaponTemplate weapon to get default magazine for + * @returns tpl of magazine + */ + getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; + /** + * Adds an item with all its childern into specified equipmentSlots, wherever it fits. + * @param equipmentSlots + * @param parentId + * @param parentTpl + * @param itemWithChildren + * @param inventory + * @returns a `boolean` indicating item was added + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): boolean; + /** + * is the provided item allowed inside a container + * @param slot location item wants to be placed in + * @param itemTpl item being placed + * @returns true if allowed + */ + protected itemAllowedInContainer(slot: Grid, itemTpl: string): boolean; +} diff --git a/Live/CWX_DebugTool/types/helpers/HideoutHelper.d.ts b/Live/CWX_DebugTool/types/helpers/HideoutHelper.d.ts index 36e4009..7495a6a 100644 --- a/Live/CWX_DebugTool/types/helpers/HideoutHelper.d.ts +++ b/Live/CWX_DebugTool/types/helpers/HideoutHelper.d.ts @@ -44,14 +44,72 @@ export declare class HideoutHelper { initProduction(recipeId: string, productionTime: number): Production; isProductionType(productive: Productive): productive is Production; applyPlayerUpgradesBonuses(pmcData: IPmcData, bonus: StageBonus): void; + /** + * TODO: + * After looking at the skills there doesnt seem to be a configuration per skill to boost + * the XP gain PER skill. I THINK you should be able to put the variable "SkillProgress" (just like health has it) + * and be able to tune the skill gain PER skill, but I havent tested it and Im not sure! + * @param pmcData + * @param bonus + */ protected applySkillXPBoost(pmcData: IPmcData, bonus: StageBonus): void; + /** + * Process a players hideout, update areas that use resources + increment production timers + * @param sessionID Session id + */ updatePlayerHideout(sessionID: string): void; + /** + * Update progress timer for water collector + * @param pmcData profile to update + * @param productionId id of water collection production to update + * @param hideoutProperties Hideout properties + */ + protected updateWaterCollectorProductionTimer(pmcData: IPmcData, productionId: string, hideoutProperties: { + btcFarmCGs?: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Update progress timer for scav case + * @param pmcData Profile to update + * @param productionId Id of scav case production to update + */ + protected updateScavCaseProductionTimer(pmcData: IPmcData, productionId: string): void; + /** + * Iterate over hideout areas that use resources (fuel/filters etc) and update associated values + * @param sessionID Session id + * @param pmcData Profile to update areas of + * @param hideoutProperties hideout properties + */ + protected updateAreasWithResources(sessionID: string, pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): HideoutArea; - protected updateWaterFilters(waterFilterArea: HideoutArea, pwProd: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; + /** + * Adjust water filter objects resourceValue or delete when they reach 0 resource + * @param waterFilterArea water filter area to update + * @param production production object + * @param isGeneratorOn is generatory enabled + * @param pmcData Player profile + * @returns Updated HideoutArea object + */ + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): HideoutArea; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; protected getBTCSlots(pmcData: IPmcData): number; protected getManagementSkillsSlots(): number; diff --git a/Live/CWX_DebugTool/types/helpers/InRaidHelper.d.ts b/Live/CWX_DebugTool/types/helpers/InRaidHelper.d.ts index b382e30..962df38 100644 --- a/Live/CWX_DebugTool/types/helpers/InRaidHelper.d.ts +++ b/Live/CWX_DebugTool/types/helpers/InRaidHelper.d.ts @@ -18,18 +18,6 @@ export declare class InRaidHelper { protected paymentHelper: PaymentHelper; protected profileFixerService: ProfileFixerService; constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); - /** - * Reset the SPT inraid property stored in a profile to 'none' - * @param sessionID Session id - */ - protected removePlayer(sessionID: string): void; - /** - * Some maps have one-time-use keys (e.g. Labs - * Remove the relevant key from an inventory based on the post-raid request data passed in - * @param offraidData post-raid data - * @param sessionID Session id - */ - protected removeMapAccessKey(offraidData: ISaveProgressRequestData, sessionID: string): void; /** * Check an array of items and add an upd object to money items with a stack count of 1 * Single stack money items have no upd object and thus no StackObjectsCount, causing issues @@ -54,6 +42,18 @@ export declare class InRaidHelper { * @returns Reset profile object */ updateProfileBaseStats(profileData: IPmcData, saveProgressRequest: ISaveProgressRequestData, sessionID: string): IPmcData; + /** + * Some maps have one-time-use keys (e.g. Labs + * Remove the relevant key from an inventory based on the post-raid request data passed in + * @param offraidData post-raid data + * @param sessionID Session id + */ + protected removeMapAccessKey(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Set the SPT inraid location Profile property to 'none' + * @param sessionID Session id + */ + protected setPlayerInRaidLocationStatusToNone(sessionID: string): void; /** * Adds SpawnedInSession property to items found in a raid * Removes SpawnedInSession for non-scav players if item was taken into raid with SpawnedInSession = true @@ -95,5 +95,10 @@ export declare class InRaidHelper { * @returns true if item is kept after death */ isItemKeptAfterDeath(slotId: string): boolean; + /** + * Return the equipped items from a players inventory + * @param items Players inventory to search through + * @returns an array of equipped items + */ getPlayerGear(items: Item[]): Item[]; } diff --git a/Live/CWX_DebugTool/types/helpers/ItemHelper.d.ts b/Live/CWX_DebugTool/types/helpers/ItemHelper.d.ts index 1701c62..0effaf2 100644 --- a/Live/CWX_DebugTool/types/helpers/ItemHelper.d.ts +++ b/Live/CWX_DebugTool/types/helpers/ItemHelper.d.ts @@ -1,35 +1,30 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { InsuredItem } from "../models/eft/common/tables/IBotBase"; import { Item, Repairable } from "../models/eft/common/tables/IItem"; +import { IStaticAmmoDetails } from "../models/eft/common/tables/ILootBase"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ObjectId } from "../utils/ObjectId"; +import { RandomUtil } from "../utils/RandomUtil"; declare class ItemHelper { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected randomUtil: RandomUtil; + protected objectId: ObjectId; + protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer); /** - * Checks if a id is a valid item. Valid meaning that it's an item that be stored in stash + * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl * @returns boolean; true for items that may be in player posession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {*} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - isValidRewardItem(tpl: string): boolean; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - getRewardableItems(): [string, ITemplateItem][]; /** * Check if the tpl / template Id provided is a descendent of the baseclass * @@ -84,6 +79,11 @@ declare class ItemHelper { * @returns {array} The array of StackSlotItems */ generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; + /** + * Get cloned copy of all item data from items.json + * @returns array of ITemplateItem objects + */ + getItems(): ITemplateItem[]; /** * Gets item data from items.json * @param tpl items template id to look up @@ -196,6 +196,22 @@ declare class ItemHelper { * @returns ItemSize object (width and height) */ getItemSize(items: Item[], rootItemId: string): ItemHelper.ItemSize; + /** + * Get a random cartridge from an items Filter property + * @param item + * @returns + */ + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + createRandomMagCartridges(magTemplate: ITemplateItem, parentId: string, staticAmmoDist: Record, caliber?: string): Item; + protected getRandomValidCaliber(magTemplate: ITemplateItem): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + createCartidges(parentId: string, ammoTpl: string, stackCount: number): Item; + /** + * Get the size of a stack, return 1 if no stack object count property found + * @param item Item to get stack size of + * @returns size of stack + */ + getItemStackSize(item: Item): number; } declare namespace ItemHelper { interface ItemSize { diff --git a/Live/CWX_DebugTool/types/helpers/ProfileHelper.d.ts b/Live/CWX_DebugTool/types/helpers/ProfileHelper.d.ts index 9d4ff98..9c6560a 100644 --- a/Live/CWX_DebugTool/types/helpers/ProfileHelper.d.ts +++ b/Live/CWX_DebugTool/types/helpers/ProfileHelper.d.ts @@ -24,6 +24,19 @@ export declare class ProfileHelper { constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; getCompleteProfile(sessionID: string): IPmcData[]; + /** + * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen + * Server saves the post-raid changes prior to the xp screen getting the profile, this results in the xp screen using + * the now updated profile values as a base, meaning it shows x2 xp gained + * Instead, clone the post-raid profile (so we dont alter its values), apply the pre-raid xp values to the cloned objects and return + * Delete snapshot of pre-raid profile prior to returning profile data + * @param sessionId Session id + * @param output pmc and scav profiles array + * @param pmcProfile post-raid pmc profile + * @param scavProfile post-raid scav profile + * @returns updated profile array + */ + protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; /** * Add experience to a PMC inside the players profile diff --git a/Live/CWX_DebugTool/types/helpers/QuestHelper.d.ts b/Live/CWX_DebugTool/types/helpers/QuestHelper.d.ts index 32e55ec..d66d150 100644 --- a/Live/CWX_DebugTool/types/helpers/QuestHelper.d.ts +++ b/Live/CWX_DebugTool/types/helpers/QuestHelper.d.ts @@ -36,11 +36,20 @@ export declare class QuestHelper { protected configServer: ConfigServer; protected questConfig: IQuestConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); - questStatus(pmcData: IPmcData, questID: string): QuestStatus; /** - * returns true is the condition is satisfied + * Get status of a quest by quest id + * @param pmcData Profile to search + * @param questID Quest id to look up + * @returns QuestStauts enum + */ + getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus; + /** + * returns true is the level condition is satisfied + * @param playerLevel Players level + * @param condition Quest condition + * @returns true if player level is greater than or equal to quest */ - evaluateLevel(pmcProfile: IPmcData, cond: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; /** * Increase skill points of a skill on player profile diff --git a/Live/CWX_DebugTool/types/helpers/RagfairOfferHelper.d.ts b/Live/CWX_DebugTool/types/helpers/RagfairOfferHelper.d.ts index 8d03bee..e9d72ca 100644 --- a/Live/CWX_DebugTool/types/helpers/RagfairOfferHelper.d.ts +++ b/Live/CWX_DebugTool/types/helpers/RagfairOfferHelper.d.ts @@ -22,12 +22,14 @@ import { ProfileHelper } from "./ProfileHelper"; import { RagfairHelper } from "./RagfairHelper"; import { RagfairServerHelper } from "./RagfairServerHelper"; import { RagfairSortHelper } from "./RagfairSortHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class RagfairOfferHelper { protected logger: ILogger; protected timeUtil: TimeUtil; protected hashUtil: HashUtil; protected itemEventRouter: ItemEventRouter; protected databaseServer: DatabaseServer; + protected traderHelper: TraderHelper; protected saveServer: SaveServer; protected dialogueHelper: DialogueHelper; protected itemHelper: ItemHelper; @@ -43,10 +45,10 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; - processOffers(sessionID: string): boolean; + processOffersOnProfile(sessionID: string): boolean; protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; diff --git a/Live/CWX_DebugTool/types/helpers/RagfairSellHelper.d.ts b/Live/CWX_DebugTool/types/helpers/RagfairSellHelper.d.ts index 6ec004a..91b8a20 100644 --- a/Live/CWX_DebugTool/types/helpers/RagfairSellHelper.d.ts +++ b/Live/CWX_DebugTool/types/helpers/RagfairSellHelper.d.ts @@ -11,6 +11,12 @@ export declare class RagfairSellHelper { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateSellChance(baseChance: number, offerPrice: number, requirementsPriceInRub: number): number; - rollForSale(sellChance: number, count: number): SellResult[]; + calculateSellChance(baseChancePercent: number, offerPriceRub: number, playerListedPriceRub: number): number; + /** + * Determine if the offer being listed will be sold + * @param sellChancePercent chance item will sell + * @param itemSellCount count of items to sell + * @returns Array of purchases of item(s) lsited + */ + rollForSale(sellChancePercent: number, itemSellCount: number): SellResult[]; } diff --git a/Live/CWX_DebugTool/types/helpers/RagfairServerHelper.d.ts b/Live/CWX_DebugTool/types/helpers/RagfairServerHelper.d.ts index e4939d1..a03cdda 100644 --- a/Live/CWX_DebugTool/types/helpers/RagfairServerHelper.d.ts +++ b/Live/CWX_DebugTool/types/helpers/RagfairServerHelper.d.ts @@ -6,6 +6,7 @@ import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -13,6 +14,9 @@ import { RandomUtil } from "../utils/RandomUtil"; import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { ProfileHelper } from "./ProfileHelper"; +/** + * Helper class for common ragfair server actions + */ export declare class RagfairServerHelper { protected randomUtil: RandomUtil; protected hashUtil: HashUtil; @@ -23,11 +27,12 @@ export declare class RagfairServerHelper { protected localeService: LocaleService; protected dialogueHelper: DialogueHelper; protected jsonUtil: JsonUtil; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; protected static goodsReturnedTemplate: string; - constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); + constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Is item valid / on blacklist / quest item * @param itemDetails diff --git a/Live/CWX_DebugTool/types/helpers/RepairHelper.d.ts b/Live/CWX_DebugTool/types/helpers/RepairHelper.d.ts index 9a3ab29..5b09320 100644 --- a/Live/CWX_DebugTool/types/helpers/RepairHelper.d.ts +++ b/Live/CWX_DebugTool/types/helpers/RepairHelper.d.ts @@ -14,8 +14,17 @@ export declare class RepairHelper { protected configServer: ConfigServer; protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); - updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit?: boolean, applyRandomDegradation?: boolean): Item; - protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number): number; - protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, armorMax: number): number; + /** + * + * @param itemToRepair item to update durability details + * @param itemToRepairDetails db details of item to repair + * @param isArmor Is item being repaired a piece of armor + * @param amountToRepair how many unit of durability to repair + * @param useRepairKit Is item being repaired with a repair kit + * @param applyMaxDurabilityDegradation should item have max durability reduced + */ + updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit: boolean, traderQualityMultipler: number, applyMaxDurabilityDegradation?: boolean): void; + protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number, traderQualityMultipler: number): number; + protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, weaponMax: number, traderQualityMultipler: number): number; isWeaponTemplate(tpl: string): boolean; } diff --git a/Live/CWX_DebugTool/types/helpers/TradeHelper.d.ts b/Live/CWX_DebugTool/types/helpers/TradeHelper.d.ts index 975062b..7ab9768 100644 --- a/Live/CWX_DebugTool/types/helpers/TradeHelper.d.ts +++ b/Live/CWX_DebugTool/types/helpers/TradeHelper.d.ts @@ -39,6 +39,12 @@ export declare class TradeHelper { * @returns */ sellItem(pmcData: IPmcData, body: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Increment the assorts buy count by number of items purchased + * Show error on screen if player attepts 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; protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/Live/CWX_DebugTool/types/helpers/TraderAssortHelper.d.ts b/Live/CWX_DebugTool/types/helpers/TraderAssortHelper.d.ts index 677dd66..025efd6 100644 --- a/Live/CWX_DebugTool/types/helpers/TraderAssortHelper.d.ts +++ b/Live/CWX_DebugTool/types/helpers/TraderAssortHelper.d.ts @@ -1,6 +1,5 @@ import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator"; import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; -import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; import { ITrader, ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; @@ -41,12 +40,7 @@ export declare class TraderAssortHelper { * @param traderId traders id * @returns a traders' assorts */ - getAssort(sessionId: string, traderId: string): ITraderAssort; - /** - * if the fence assorts have expired, re-generate them - * @param pmcProfile Players profile - */ - refreshFenceAssortIfExpired(pmcProfile: IPmcData): void; + getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; /** * Reset a traders assorts and move nextResupply value to future * Flag trader as needing a flea offer reset to be picked up by flea update() function diff --git a/Live/CWX_DebugTool/types/helpers/TraderHelper.d.ts b/Live/CWX_DebugTool/types/helpers/TraderHelper.d.ts index 6bda5cd..0dc93e8 100644 --- a/Live/CWX_DebugTool/types/helpers/TraderHelper.d.ts +++ b/Live/CWX_DebugTool/types/helpers/TraderHelper.d.ts @@ -65,7 +65,7 @@ export declare class TraderHelper { * @param item * @returns boolean */ - protected isWeaponAndBelowTraderBuyDurability(traderID: string, item: Item): boolean; + protected isWeaponBelowTraderBuyDurability(traderID: string, item: Item): boolean; /** * Get the price of an item and all of its attached children * Take into account bonuses/adjsutments e.g. discounts diff --git a/Live/CWX_DebugTool/types/loaders/PreAkiModLoader.d.ts b/Live/CWX_DebugTool/types/loaders/PreAkiModLoader.d.ts index d310ae2..4ab1689 100644 --- a/Live/CWX_DebugTool/types/loaders/PreAkiModLoader.d.ts +++ b/Live/CWX_DebugTool/types/loaders/PreAkiModLoader.d.ts @@ -44,9 +44,9 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getDuplicates(stringArray: string[]): string[]; /** - * - * @param mods Get an array of broken/invalid mods by name - * @returns Mod names array + * Get an array of mods with errors that prevent them from working with SPT + * @param mods mods to validate + * @returns Mod names as array */ protected getBrokenMods(mods: string[]): string[]; /** @@ -68,7 +68,12 @@ export declare class PreAkiModLoader implements IModLoader { protected addMod(mod: string): Promise; protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record): boolean; protected isModCompatible(mod: IPackageJsonData, loadedMods: Record): boolean; - protected validMod(mod: string): boolean; + /** + * Validate a mod passes a number of checks + * @param modName name of mod in /mods/ to validate + * @returns true if valid + */ + protected validMod(modName: string): boolean; protected getLoadOrderRecursive(mod: string, result: Record, visited: Record): void; protected getLoadOrder(mods: Record): Record; getContainer(): DependencyContainer; diff --git a/Live/CWX_DebugTool/types/models/eft/common/IGlobals.d.ts b/Live/CWX_DebugTool/types/models/eft/common/IGlobals.d.ts index 9d28dbc..81e2023 100644 --- a/Live/CWX_DebugTool/types/models/eft/common/IGlobals.d.ts +++ b/Live/CWX_DebugTool/types/models/eft/common/IGlobals.d.ts @@ -1175,5 +1175,6 @@ export interface Preset { _name: string; _parent: string; _items: Item[]; + /** Default presets have this property */ _encyclopedia?: string; } diff --git a/Live/CWX_DebugTool/types/models/eft/common/tables/IBotBase.d.ts b/Live/CWX_DebugTool/types/models/eft/common/tables/IBotBase.d.ts index 64166f4..25cb861 100644 --- a/Live/CWX_DebugTool/types/models/eft/common/tables/IBotBase.d.ts +++ b/Live/CWX_DebugTool/types/models/eft/common/tables/IBotBase.d.ts @@ -28,6 +28,8 @@ export interface IBotBase { CarExtractCounts: CarExtractCounts; SurvivorClass: SurvivorClass; WishList: string[]; + /** SPT specific property used during bot generation in raid */ + sptIsPmc?: boolean; } export interface Info { EntryPoint: string; diff --git a/Live/CWX_DebugTool/types/models/eft/common/tables/ITemplateItem.d.ts b/Live/CWX_DebugTool/types/models/eft/common/tables/ITemplateItem.d.ts index 23a1a14..8569e61 100644 --- a/Live/CWX_DebugTool/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/Live/CWX_DebugTool/types/models/eft/common/tables/ITemplateItem.d.ts @@ -34,6 +34,7 @@ export interface Props { LootExperience?: number; ExamineExperience?: number; HideEntrails?: boolean; + InsuranceDisabled?: boolean; RepairCost?: number; RepairSpeed?: number; ExtraSizeLeft?: number; @@ -79,7 +80,7 @@ export interface Props { HasShoulderContact?: boolean; SightingRange?: number; DoubleActionAccuracyPenaltyMult?: number; - ModesCount: any; + ModesCount?: any; DurabilityBurnModificator?: number; HeatFactor?: number; CoolFactor?: number; @@ -155,7 +156,7 @@ export interface Props { RigLayoutName?: string; MaxDurability?: number; armorZone?: string[]; - armorClass: any; + armorClass?: any; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -206,6 +207,7 @@ export interface Props { IsOneoff?: boolean; MustBoltBeOpennedForExternalReload?: boolean; MustBoltBeOpennedForInternalReload?: boolean; + NoFiremodeOnBoltcatch?: boolean; BoltAction?: boolean; HipAccuracyRestorationDelay?: number; HipAccuracyRestorationSpeed?: number; @@ -252,8 +254,8 @@ export interface Props { foodUseTime?: number; foodEffectType?: string; StimulatorBuffs?: string; - effects_health: any; - effects_damage: any; + effects_health?: any; + effects_damage?: any; MaximumNumberOfUsage?: number; knifeHitDelay?: number; knifeHitSlashRate?: number; diff --git a/Live/CWX_DebugTool/types/models/eft/common/tables/ITrader.d.ts b/Live/CWX_DebugTool/types/models/eft/common/tables/ITrader.d.ts index a84f5af..37b2d61 100644 --- a/Live/CWX_DebugTool/types/models/eft/common/tables/ITrader.d.ts +++ b/Live/CWX_DebugTool/types/models/eft/common/tables/ITrader.d.ts @@ -67,6 +67,7 @@ export interface IBarterScheme { count: number; _tpl: string; onlyFunctional?: boolean; + sptQuestLocked?: boolean; } export interface ISuit { _id: string; diff --git a/Live/CWX_DebugTool/types/models/eft/ragfair/IRagfairOffer.d.ts b/Live/CWX_DebugTool/types/models/eft/ragfair/IRagfairOffer.d.ts index 63f655e..141b605 100644 --- a/Live/CWX_DebugTool/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/Live/CWX_DebugTool/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -15,6 +15,8 @@ export interface IRagfairOffer { name?: string; shortName?: string; loyaltyLevel: number; + buyRestrictionMax?: number; + buyRestrictionCurrent?: number; locked: boolean; unlimitedCount: boolean; summaryCost: number; diff --git a/Live/CWX_DebugTool/types/models/enums/AmmoTypes.d.ts b/Live/CWX_DebugTool/types/models/enums/AmmoTypes.d.ts index b52ddcf..254b410 100644 --- a/Live/CWX_DebugTool/types/models/enums/AmmoTypes.d.ts +++ b/Live/CWX_DebugTool/types/models/enums/AmmoTypes.d.ts @@ -23,7 +23,7 @@ export declare enum Ammo762x54 { BT_GZH = "5e023d34e8a400319a28ed44", BS_GZH = "5e023d48186a883be655e551" } -export declare enum Ammo338Lapua { +export declare enum Ammo86x70 { TAC_X = "5fc382b6d6fa9c00c571bbc3", UCW = "5fc382c1016cce60e8341b20", AP = "5fc382a9d724d907e2077dab", @@ -85,13 +85,13 @@ export declare enum Ammo9x21 { PE_GZH = "5a26ac06c4a282000c5a90a8", BT_GZH = "5a26ac0ec4a28200741e1e18" } -export declare enum Ammo357Mag { +export declare enum Ammo9x33R { FMJ = "62330b3ed4dc74626d570b95", HOLLOW_POINT = "62330bfadc5883093563729b", SOFT_POINT = "62330c40bdd19b369e1e53d1", JACKET_HP = "62330c18744e5e31df12f516" } -export declare enum Ammo45ACP { +export declare enum Ammo1143x23ACP { MATCH_FMJ = "5e81f423763d9f754677bf2e", HYDRA_SHOK = "5efb0fc6aeb21837e749c801", LASERMATCH_FMJ = "5efb0d4f4bc50b58e81710f3", @@ -126,7 +126,7 @@ export declare enum Ammo556x45 { MK_318_MOD_0_SOST = "60194943740c5d77f6705eea", SSA_AP = "601949593ae8f707c4608daa" } -export declare enum Ammo300Blackout { +export declare enum Ammo762x35 { M62_TRACER = "619636be6db0f2477964e710", BCP_FMJ = "5fbe3ffdf8b6a877a729ea82", AP = "5fd20ff893a8961fc660a954", diff --git a/Live/CWX_DebugTool/types/models/enums/BaseClasses.d.ts b/Live/CWX_DebugTool/types/models/enums/BaseClasses.d.ts index e733bca..36ebc71 100644 --- a/Live/CWX_DebugTool/types/models/enums/BaseClasses.d.ts +++ b/Live/CWX_DebugTool/types/models/enums/BaseClasses.d.ts @@ -25,6 +25,7 @@ export declare enum BaseClasses { SIGHTS = "5448fe7a4bdc2d6f028b456b", MEDS = "543be5664bdc2dd4348b4569", MONEY = "543be5dd4bdc2deb348b4569", + NIGHTVISION = "5a2c3a9486f774688b05e574", KEY = "543be5e94bdc2df1348b4568", KEY_MECHANICAL = "5c99f98d86f7745c314214b3", KEYCARD = "5c164d2286f774194c5e69fa", @@ -66,8 +67,8 @@ export declare enum BaseClasses { LUBRICANT = "57864e4c24597754843f8723", BATTERY = "57864ee62459775490116fc1", ASSAULT_SCOPE = "55818add4bdc2d5b648b456f", - REFLEX_SIGHT = "55818ad54bdc2ddc698b4569", TACTICAL_COMBO = "55818b164bdc2ddc698b456c", + FLASHLIGHT = "55818b084bdc2d5b648b4571", MAGAZINE = "5448bc234bdc2d3c308b4569", LIGHT_LASER = "55818b0e4bdc2dde698b456e", FLASH_HIDER = "550aa4bf4bdc2dd6348b456b", diff --git a/Live/CWX_DebugTool/types/models/enums/ConfigTypes.d.ts b/Live/CWX_DebugTool/types/models/enums/ConfigTypes.d.ts index 61d6f99..468ece5 100644 --- a/Live/CWX_DebugTool/types/models/enums/ConfigTypes.d.ts +++ b/Live/CWX_DebugTool/types/models/enums/ConfigTypes.d.ts @@ -8,6 +8,7 @@ export declare enum ConfigTypes { IN_RAID = "aki-inraid", INSURANCE = "aki-insurance", INVENTORY = "aki-inventory", + ITEM = "aki-item", LOCALE = "aki-locale", LOCATION = "aki-location", MATCH = "aki-match", diff --git a/Live/CWX_DebugTool/types/models/enums/ELocationName.d.ts b/Live/CWX_DebugTool/types/models/enums/ELocationName.d.ts index b56cc08..7ae7caa 100644 --- a/Live/CWX_DebugTool/types/models/enums/ELocationName.d.ts +++ b/Live/CWX_DebugTool/types/models/enums/ELocationName.d.ts @@ -1,5 +1,6 @@ export declare enum ELocationName { FACTORY_DAY = "factory4_day", + FACTORY_NIGHT = "factory4_night", BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", diff --git a/Live/CWX_DebugTool/types/models/enums/WeaponTypes.d.ts b/Live/CWX_DebugTool/types/models/enums/WeaponTypes.d.ts new file mode 100644 index 0000000..867b052 --- /dev/null +++ b/Live/CWX_DebugTool/types/models/enums/WeaponTypes.d.ts @@ -0,0 +1,151 @@ +export declare enum Weapons127x55 { + ASH_12 = "5cadfbf7ae92152ac412eeef" +} +export declare enum Weapons86x70 { + MK_18 = "5fc22d7c187fea44d52eda44", + AXMC = "627e14b21713922ded6f2c15" +} +export declare enum Weapons9x39 { + AS_VAL = "57c44b372459772d2b39b8ce", + VSS_VINTOREZ = "57838ad32459774a17445cd2" +} +export declare enum Weapons762x54R { + SVDS = "5c46fbd72e2216398b5a8c9c", + MP_18 = "61f7c9e189e6fb1a5e3ea78d", + MOSIN_INFANTRY = "5bfd297f0db834001a669119", + MOSIN_SNIPER = "5ae08f0a5acfc408fb1398a1", + SV_98 = "55801eed4bdc2d89578b4588" +} +export declare enum Weapons762x51 { + VPO_101 = "5c501a4d2e221602b412b540", + DT_MDR_762 = "5dcbd56fdbd3d91b3e5468d5", + SA_58 = "5b0bbe4e5acfc40dc528a72d", + SCARH_BLACK = "6183afd850224f204c1da514", + SCARH_FDE = "6165ac306ef05c2ce828ef74", + HK_G28 = "6176aca650224f204c1da3fb", + M1A = "5aafa857e5b5b00018480968", + RFB = "5f2a9575926fd9352339381f", + RSASS = "5a367e5dc4a282000e49738f", + SR_25 = "5df8ce05b11454561e39243b", + DVL_10 = "588892092459774ac91d4b11", + M700 = "5bfea6e90db834001b7347f3", + T5000M = "5df24cf80dee1b22f862e9bc" +} +export declare enum Weapons366TKM { + VPO_209 = "59e6687d86f77411d949b251", + VPO_215 = "5de652c31b7e3716273428be" +} +export declare enum Weapons762x39 { + OP_SKS = "587e02ff24597743df3deaeb", + SKS = "574d967124597745970e7c94", + AK_103 = "5ac66d2e5acfc43b321d4b53", + AK_104 = "5ac66d725acfc43b321d4b60", + AKM = "59d6088586f774275f37482f", + AKMN = "5a0ec13bfcdbcb00165aa685", + AKMS = "59ff346386f77477562ff5e2", + AKMSN = "5abcbc27d8ce8700182eceeb", + MK47_MUTANT = "606587252535c57a13424cfd", + RD_704 = "628a60ae6b1d481ff772e9c8", + VPO_136 = "59e6152586f77473dc057aa1" +} +export declare enum Weapons762x35 { + MCX = "5fbcc1d9016cce60e8341ab3" +} +export declare enum Weapons556x45 { + ADAR_2_15 = "5c07c60e0db834002330051f", + AK_101 = "5ac66cb05acfc40198510a10", + AK_102 = "5ac66d015acfc400180ae6e4", + DT_MDR_556 = "5c488a752e221602b412af63", + HK_416A5 = "5bb2475ed4351e00853264e3", + HK_G36 = "623063e994fc3f7b302a9696", + M4A1 = "5447a9cd4bdc2dbd208b4567", + SCARL_BLACK = "6184055050224f204c1da540", + SCARL_FDE = "618428466ef05c2ce828f218", + TX15_DML = "5d43021ca4b9362eab4b5e25" +} +export declare enum Weapons545x39 { + AK_105 = "5ac66d9b5acfc4001633997a", + AK_74 = "5bf3e03b0db834001d2c4a9c", + AK_74M = "5ac4cd105acfc40016339859", + AK_74N = "5644bd2b4bdc2d3b4c8b4572", + AKS_74 = "5bf3e0490db83400196199af", + AKS_74N = "5ab8e9fcd8ce870019439434", + AKS_74U = "57dc2fa62459775949412633", + AKS_74UB = "5839a40f24597726f856b511", + AKS_74UN = "583990e32459771419544dd2", + SAG_AK = "628b5638ad252a16da6dd245", + SAG_AK_SHORT = "628b9c37a733087d0d7fe84b", + RPK_16 = "5beed0f50db834001c062b12" +} +export declare enum Weapons57x28FN { + FN_57_BLACK = "5d3eb3b0a4b93615055e84d2", + FN_57_FDE = "5d67abc1a4b93614ec50137f", + FN_P90 = "5cc82d76e24e8d00134b4b83" +} +export declare enum Weapons46x30HK { + MP7A1 = "5ba26383d4351e00334c93d9", + MP7A2 = "5bd70322209c4d00d7167b8f" +} +export declare enum Weapons1143x23 { + M1911A1 = "5e81c3cbac2bb513793cdc75", + M45A1 = "5f36a0e5fbf956000b716b65", + USP45 = "6193a720f8ee7e52e42109ed", + UMP45 = "5fc3e272f8b6a877a729eac5", + VECTOR45 = "5fb64bc92b1b027b1f50bcf2" +} +export declare enum Weapons9x33R { + CR_50DS = "61a4c8884f95bc3b2c5dc96f" +} +export declare enum Weapons9x21 { + SR_1MP = "59f98b4986f7746f546d2cef" +} +export declare enum Weapons9x19 { + GLOCK_17 = "5a7ae0c351dfba0017554310", + GLOCK_18C = "5b1fa9b25acfc40018633c01", + M9A3 = "5cadc190ae921500103bb3b6", + MP_443 = "576a581d2459771e7b1bc4f1", + P226R = "56d59856d2720bd8418b456a", + PL_15 = "602a9740da11d6478d5a06dc", + CR_200DS = "624c2e8614da335f1e034d8c", + MP5 = "5926bb2186f7744b1c6c6e60", + MP5K = "5d2f0d8048f0356c925bc3b0", + MP9 = "5e00903ae9dc277128008b87", + MP9_N = "5de7bd7bfd6b4e6e2276dc25", + MPX = "58948c8e86f77409493f7266", + PP_19_01 = "59984ab886f7743e98271174", + SAIGA_9 = "59f9cabd86f7743a10721f46", + STM_9 = "60339954d62c9b14ed777c06", + VECTOR_9MM = "5fc3f2d5900b1d5091531e57" +} +export declare enum Weapons9x18 { + APB = "5abccb7dd8ce87001773e277", + APS = "5a17f98cfcdbcb0980087290", + PB_SILENCED = "56e0598dd2720bb5668b45a6", + PM = "5448bd6b4bdc2dfc2f8b4569", + PM_T = "579204f224597773d619e051", + PP9_KLIN = "57f4c844245977379d5c14d1", + PP91_KEDR = "57d14d2524597714373db789", + PP91_KEDRB = "57f3c6bd24597738e730fa2f" +} +export declare enum Weapons762x25 { + TT = "571a12c42459771f627b58a0", + TT_GOLD = "5b3b713c5acfc4330140bd8d", + PPSH_41 = "5ea03f7400685063ec28bfa8" +} +export declare enum Weapons12Gauge { + M3_SUPER90 = "6259b864ebedf17603599e88", + M590A1 = "5e870397991fd70db46995c8", + M870 = "5a7828548dc32e5a9c28b516", + MP_133 = "54491c4f4bdc2db1078b4568", + MP_153 = "56dee2bdd2720bc8328b4567", + MP_155 = "606dae0ab0e443224b421bb7", + MP_43_1C = "5580223e4bdc2d1c128b457f", + MTS_255_12 = "60db29ce99594040e04c4a27", + SAIGA_12GA = "576165642459773c7a400233" +} +export declare enum Weapons20Gauge { + TOZ_106 = "5a38e6bac4a2826c6e06d79b" +} +export declare enum Weapons23x75 { + KS_23M = "5e848cc2988a8701445df1e8" +} diff --git a/Live/CWX_DebugTool/types/models/spt/config/IAirdropConfig.d.ts b/Live/CWX_DebugTool/types/models/spt/config/IAirdropConfig.d.ts index f4aee89..3edcbdd 100644 --- a/Live/CWX_DebugTool/types/models/spt/config/IAirdropConfig.d.ts +++ b/Live/CWX_DebugTool/types/models/spt/config/IAirdropConfig.d.ts @@ -1,14 +1,14 @@ +import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IAirdropConfig extends IBaseConfig { kind: "aki-airdrop"; airdropChancePercent: AirdropChancePercent; - airdropMinOpenHeight: number; - airdropMaxOpenHeight: number; planeMinFlyHeight: number; planeMaxFlyHeight: number; planeVolume: number; airdropMinStartTimeSeconds: number; airdropMaxStartTimeSeconds: number; + loot: AirdropLoot; } export interface AirdropChancePercent { bigmap: number; @@ -18,3 +18,13 @@ export interface AirdropChancePercent { interchange: number; reserve: number; } +export interface AirdropLoot { + presetCount: MinMax; + itemCount: MinMax; + itemBlacklist: string[]; + itemTypeWhitelist: string[]; + /** key: item base type: value: max count */ + itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; +} diff --git a/Live/CWX_DebugTool/types/models/spt/config/IBotConfig.d.ts b/Live/CWX_DebugTool/types/models/spt/config/IBotConfig.d.ts index e171087..af8ceba 100644 --- a/Live/CWX_DebugTool/types/models/spt/config/IBotConfig.d.ts +++ b/Live/CWX_DebugTool/types/models/spt/config/IBotConfig.d.ts @@ -1,17 +1,31 @@ import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; +import { IBotDurability } from "./IBotDurability"; +import { IPmcConfig } from "./IPmcConfig"; export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; + /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** What bot types should be classified as bosses */ bosses: string[]; - durability: Durability; + /** Control weapon/armor durability min/max values for each bot type */ + durability: IBotDurability; + /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ lootNValue: LootNvalue; + /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; - pmc: PmcConfig; + /** PMC bot specific config settings */ + pmc: IPmcConfig; + /** Control how many items are allowed to spawn on a bot + * key: bottype, value: */ itemSpawnLimits: Record>; - equipment: Record; + /** Blacklist/whitelist items on a bot */ + equipment: Record; + /** Show a bots botType value after their name */ showTypeInNickname: boolean; - maxBotCap: number; + /** Max number of bots that can be spawned in a raid at any one time */ + maxBotCap: Record; + /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; } export interface PresetBatch { @@ -44,79 +58,23 @@ export interface PresetBatch { test: number; exUsec: number; } -export interface Durability { - default: DefaultDurability; - pmc: PmcDurability; - boss: BotDurability; - follower: BotDurability; - assault: BotDurability; - cursedassault: BotDurability; - marksman: BotDurability; - pmcbot: BotDurability; - exusec: BotDurability; - sectantpriest: BotDurability; - sectantwarrior: BotDurability; -} -export interface DefaultDurability { - armor: DefaultArmor; - weapon: WeaponDurability; -} -export interface DefaultArmor { - maxDelta: number; - minDelta: number; -} -export interface WeaponDurability { - lowestMax: number; - highestMax: number; - maxDelta: number; - minDelta: number; -} -export interface PmcDurability { - armor: PmcDurabilityArmor; - weapon: WeaponDurability; -} -export interface PmcDurabilityArmor { - lowestMaxPercent: number; - highestMaxPercent: number; - maxDelta: number; - minDelta: number; -} -export interface BotDurability { - armor: ArmorDurability; - weapon: WeaponDurability; -} -export interface ArmorDurability { - maxDelta: number; - minDelta: number; -} export interface LootNvalue { scav: number; pmc: number; } -export interface PmcConfig { - dynamicLoot: PmcDynamicLoot; - difficulty: string; - looseWeaponInBackpackChancePercent: number; - looseWeaponInBackpackLootMinMax: MinMax; - isUsec: number; - chanceSameSideIsHostilePercent: number; - usecType: string; - bearType: string; - maxBackpackLootTotalRub: number; - maxPocketLootTotalRub: number; - maxVestLootTotalRub: number; - convertIntoPmcChance: Record; - enemyTypes: string[]; -} -export interface PmcDynamicLoot { - whitelist: string[]; - blacklist: string[]; - moneyStackLimits: Record; -} -export interface Equipment { +export interface EquipmentFilters { + weaponModLimits: ModLimits; + randomisedWeaponModSlots?: string[]; + randomisedArmorSlots?: string[]; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; } +export interface ModLimits { + /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ + scopeLimit?: number; + /** How many lasers or lights are allowed on a weapon - hard coded to work with TACTICAL_COMBO, and FLASHLIGHT */ + lightLaserLimit?: number; +} export interface EquipmentFilterDetails { levelRange: MinMax; equipment: Record; diff --git a/Live/CWX_DebugTool/types/models/spt/config/IBotDurability.d.ts b/Live/CWX_DebugTool/types/models/spt/config/IBotDurability.d.ts new file mode 100644 index 0000000..38a47cc --- /dev/null +++ b/Live/CWX_DebugTool/types/models/spt/config/IBotDurability.d.ts @@ -0,0 +1,47 @@ +export interface IBotDurability { + default: DefaultDurability; + pmc: PmcDurability; + boss: BotDurability; + follower: BotDurability; + assault: BotDurability; + cursedassault: BotDurability; + marksman: BotDurability; + pmcbot: BotDurability; + exusec: BotDurability; + gifter: BotDurability; + sectantpriest: BotDurability; + sectantwarrior: BotDurability; +} +/** Durability values to be used when a more specific bot type cant be found */ +export interface DefaultDurability { + armor: DefaultArmor; + weapon: WeaponDurability; +} +export interface DefaultArmor { + maxDelta: number; + minDelta: number; +} +export interface WeaponDurability { + lowestMax: number; + highestMax: number; + maxDelta: number; + minDelta: number; +} +export interface PmcDurability { + armor: PmcDurabilityArmor; + weapon: WeaponDurability; +} +export interface PmcDurabilityArmor { + lowestMaxPercent: number; + highestMaxPercent: number; + maxDelta: number; + minDelta: number; +} +export interface BotDurability { + armor: ArmorDurability; + weapon: WeaponDurability; +} +export interface ArmorDurability { + maxDelta: number; + minDelta: number; +} diff --git a/Live/CWX_DebugTool/types/models/spt/config/IItemConfig.d.ts b/Live/CWX_DebugTool/types/models/spt/config/IItemConfig.d.ts new file mode 100644 index 0000000..5ecccc2 --- /dev/null +++ b/Live/CWX_DebugTool/types/models/spt/config/IItemConfig.d.ts @@ -0,0 +1,5 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface IItemConfig extends IBaseConfig { + kind: "aki-item"; + blacklist: string[]; +} diff --git a/Live/CWX_DebugTool/types/models/spt/config/IPmcConfig.d.ts b/Live/CWX_DebugTool/types/models/spt/config/IPmcConfig.d.ts new file mode 100644 index 0000000..9db2ba1 --- /dev/null +++ b/Live/CWX_DebugTool/types/models/spt/config/IPmcConfig.d.ts @@ -0,0 +1,26 @@ +import { MinMax } from "../../common/MinMax"; +export interface IPmcConfig { + dynamicLoot: DynamicLoot; + useDifficultyOverride: boolean; + difficulty: string; + looseWeaponInBackpackChancePercent: number; + looseWeaponInBackpackLootMinMax: MinMax; + isUsec: number; + chanceSameSideIsHostilePercent: number; + /** key: location, value: type for usec/bear */ + pmcType: Record; + maxBackpackLootTotalRub: number; + maxPocketLootTotalRub: number; + maxVestLootTotalRub: number; + convertIntoPmcChance: Record; + enemyTypes: string[]; +} +export interface PmcTypes { + usec: string; + bear: string; +} +export interface DynamicLoot { + whitelist: string[]; + blacklist: string[]; + moneyStackLimits: Record; +} diff --git a/Live/CWX_DebugTool/types/models/spt/config/IQuestConfig.d.ts b/Live/CWX_DebugTool/types/models/spt/config/IQuestConfig.d.ts index be4a97b..45c9aae 100644 --- a/Live/CWX_DebugTool/types/models/spt/config/IQuestConfig.d.ts +++ b/Live/CWX_DebugTool/types/models/spt/config/IQuestConfig.d.ts @@ -4,6 +4,8 @@ export interface IQuestConfig extends IBaseConfig { kind: "aki-quest"; redeemTime: number; repeatableQuests: IRepeatableQuestConfig[]; + bearOnlyQuests: string[]; + usecOnlyQuests: string[]; } export interface IRepeatableQuestConfig { name: string; @@ -15,6 +17,10 @@ export interface IRepeatableQuestConfig { locations: Record; traderWhitelist: ITraderWhitelist[]; questConfig: IQuestConfig; + /** Item base types to block when generating rewards */ + rewardBaseTypeBlacklist: string[]; + /** Item tplIds to ignore when generating rewards */ + rewardBlacklist: string[]; } export interface IRewardScaling { levels: number[]; diff --git a/Live/CWX_DebugTool/types/models/spt/config/IRagfairConfig.d.ts b/Live/CWX_DebugTool/types/models/spt/config/IRagfairConfig.d.ts index 6369eda..c1b8763 100644 --- a/Live/CWX_DebugTool/types/models/spt/config/IRagfairConfig.d.ts +++ b/Live/CWX_DebugTool/types/models/spt/config/IRagfairConfig.d.ts @@ -12,6 +12,7 @@ export interface Sell { chance: Chance; time: Time; reputation: Reputation; + simulatedSellHours: number; } export interface Chance { base: number; @@ -38,6 +39,7 @@ export interface Dynamic { offerItemCount: MinMax; price: MinMax; presetPrice: MinMax; + showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; condition: Condition; stackablePercent: MinMax; diff --git a/Live/CWX_DebugTool/types/models/spt/config/ITraderConfig.d.ts b/Live/CWX_DebugTool/types/models/spt/config/ITraderConfig.d.ts index c8e8044..6b1c1e3 100644 --- a/Live/CWX_DebugTool/types/models/spt/config/ITraderConfig.d.ts +++ b/Live/CWX_DebugTool/types/models/spt/config/ITraderConfig.d.ts @@ -12,8 +12,10 @@ export interface UpdateTime { seconds: number; } export interface FenceConfig { + partialRefreshTimeSeconds: number; + partialRefreshChangePercent: number; assortSize: number; - maxPresetsCount: number; + maxPresetsPercent: number; presetPriceMult: number; blacklist: string[]; } diff --git a/Live/CWX_DebugTool/types/models/spt/location/AirDropLootItem.d.ts b/Live/CWX_DebugTool/types/models/spt/location/AirDropLootItem.d.ts new file mode 100644 index 0000000..da791ff --- /dev/null +++ b/Live/CWX_DebugTool/types/models/spt/location/AirDropLootItem.d.ts @@ -0,0 +1,6 @@ +export declare class AirDropLootItem { + id: string; + tpl: string; + isPreset: boolean; + stackCount: number; +} diff --git a/Live/CWX_DebugTool/types/models/spt/services/LootItem.d.ts b/Live/CWX_DebugTool/types/models/spt/services/LootItem.d.ts new file mode 100644 index 0000000..acb7606 --- /dev/null +++ b/Live/CWX_DebugTool/types/models/spt/services/LootItem.d.ts @@ -0,0 +1,6 @@ +export declare class LootItem { + id?: string; + tpl: string; + isPreset: boolean; + stackCount: number; +} diff --git a/Live/CWX_DebugTool/types/models/spt/services/LootRequest.d.ts b/Live/CWX_DebugTool/types/models/spt/services/LootRequest.d.ts new file mode 100644 index 0000000..1da8770 --- /dev/null +++ b/Live/CWX_DebugTool/types/models/spt/services/LootRequest.d.ts @@ -0,0 +1,11 @@ +import { MinMax } from "../../common/MinMax"; +export declare class LootRequest { + presetCount: MinMax; + itemCount: MinMax; + itemBlacklist: string[]; + itemTypeWhitelist: string[]; + /** key: item base type: value: max count */ + itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; +} diff --git a/Live/CWX_DebugTool/types/servers/DatabaseServer.d.ts b/Live/CWX_DebugTool/types/servers/DatabaseServer.d.ts index aa152d0..b3d29e9 100644 --- a/Live/CWX_DebugTool/types/servers/DatabaseServer.d.ts +++ b/Live/CWX_DebugTool/types/servers/DatabaseServer.d.ts @@ -2,5 +2,5 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; export declare class DatabaseServer { protected tableData: IDatabaseTables; getTables(): IDatabaseTables; - setTables(any: any): void; + setTables(tableData: IDatabaseTables): void; } diff --git a/Live/CWX_DebugTool/types/services/BotEquipmentFilterService.d.ts b/Live/CWX_DebugTool/types/services/BotEquipmentFilterService.d.ts index e49645b..632f961 100644 --- a/Live/CWX_DebugTool/types/services/BotEquipmentFilterService.d.ts +++ b/Live/CWX_DebugTool/types/services/BotEquipmentFilterService.d.ts @@ -1,12 +1,12 @@ import { IBotType } from "../models/eft/common/tables/IBotType"; -import { Equipment, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; protected configServer: ConfigServer; protected botConfig: IBotConfig; - protected botEquipmentFilterlists: Record; + protected botEquipmentFilterlists: Record; constructor(logger: ILogger, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig @@ -22,7 +22,7 @@ export declare class BotEquipmentFilterService { * @param playerLevel Level of the player * @returns EquipmentBlacklistDetails object */ - protected getBotEquipmentBlacklist(botRole: string, playerLevel: number): EquipmentFilterDetails; + getBotEquipmentBlacklist(botRole: string, playerLevel: number): EquipmentFilterDetails; /** * Get the whitelist for a specific bot type that's within the players level * @param botRole Bot type diff --git a/Live/CWX_DebugTool/types/services/BotGenerationCacheService.d.ts b/Live/CWX_DebugTool/types/services/BotGenerationCacheService.d.ts new file mode 100644 index 0000000..670c583 --- /dev/null +++ b/Live/CWX_DebugTool/types/services/BotGenerationCacheService.d.ts @@ -0,0 +1,52 @@ +import { BotHelper } from "../helpers/BotHelper"; +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotGenerationCacheService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected botHelper: BotHelper; + protected storedBots: IBotBase[]; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); + /** + * Store array of bots in cache, shuffle results before storage + * @param botsToStore + */ + storeBots(botsToStore: IBotBase[]): void; + /** + * Find and return a bot based on its role + * Remove bot from internal array so it can't be retreived again + * @param role role to retreive (assault/bossTagilla etc) + * @returns IBotBase object + */ + getBot(role: string): IBotBase[]; + /** + * Find a bot by its index from cache + * @param indexOfBotToReturn index to find bot by + * @returns bot profile + */ + protected getBotFromCache(indexOfBotToReturn: number): IBotBase; + /** + * Remove bot profile by index from cache + * @param indexOfBotToReturn Index of bot profile to remove + */ + protected removeBotFromCache(indexOfBotToReturn: number): void; + /** + * Get index of bot profile that matches criteria + * @param role role of bot we want + * @param getPmc is requested bot a pmc + * @returns index of found bot + */ + protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; + /** + * Remove all cached bot profiles + */ + clearStoredBots(): void; + /** + * Does cache have bots + * @returns true if empty + */ + cacheIsEmpty(): boolean; +} diff --git a/Live/CWX_DebugTool/types/services/BotLootCacheService.d.ts b/Live/CWX_DebugTool/types/services/BotLootCacheService.d.ts index cc71eee..00ffb9c 100644 --- a/Live/CWX_DebugTool/types/services/BotLootCacheService.d.ts +++ b/Live/CWX_DebugTool/types/services/BotLootCacheService.d.ts @@ -34,6 +34,17 @@ export declare class BotLootCacheService { * @param isPmc Is the bot a PMC (alteres what loot is cached) */ protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; + /** + * Sort a pool of item objects by its flea price + * @param poolToSort pool of items to sort + */ + protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; + /** + * Add unique items into combined pool + * @param combinedItemPool Pool of items to add to + * @param itemsToAdd items to add to combined pool if unique + */ + protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; /** * Ammo/grenades have this property * @param props diff --git a/Live/CWX_DebugTool/types/services/FenceService.d.ts b/Live/CWX_DebugTool/types/services/FenceService.d.ts index c9e325e..23fbf52 100644 --- a/Live/CWX_DebugTool/types/services/FenceService.d.ts +++ b/Live/CWX_DebugTool/types/services/FenceService.d.ts @@ -12,6 +12,11 @@ import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { ItemFilterService } from "./ItemFilterService"; +/** + * Handle actions surrounding Fence + * e.g. generating or refreshing assorts / get next refresh time + */ export declare class FenceService { protected logger: ILogger; protected hashUtil: HashUtil; @@ -22,18 +27,75 @@ export declare class FenceService { protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); + protected nextMiniRefreshTimestamp: number; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; - getFenceAssorts(): ITraderAssort; + /** + * Get assorts player can purchase + * Adjust prices based on fence level of player + * @param pmcProfile Player profile + * @returns ITraderAssort + */ + getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Get fence assorts with no price adjustments based on fence rep + * @returns ITraderAssort + */ + getRawFenceAssorts(): ITraderAssort; + /** + * Does fence need to perform a partial refresh because its passed the refresh timer defined in trader.json + * @returns true if it needs a partial refresh + */ + needsPartialRefresh(): boolean; + /** + * Replace a percentage of fence assorts with freshly generated items + */ + performPartialRefresh(): void; + /** + * Increment fence next refresh timestamp by current timestamp + partialRefreshTimeSeconds from config + */ + protected incrementPartialRefreshTime(): void; + /** + * Compare the current fence offer count to what the config wants it to be, + * If value is lower add extra count to value to generate more items to fill gap + * @param existingItemCountToReplace count of items to generate + * @returns number of items to generate + */ + protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + /** + * Choose an item (not mod) at random and remove from assorts + */ + protected removeRandomItemFromAssorts(): void; + /** + * Get an integer rounded count of items to replace based on percentrage from traderConfig value + * @param totalItemCount total item count + * @returns rounded int of items to replace + */ + protected getCountOfItemsToReplace(totalItemCount: number): number; /** * Get the count of items fence offers * @returns number */ getOfferCount(): number; - generateFenceAssortCache(pmcData: IPmcData): void; + /** + * Create a trader assort for fence + */ + generateFenceAssortCache(): void; + /** + * Create skeleton to hold assort items + * @returns ITraderAssort object + */ + protected createBaseTraderAssortItem(): ITraderAssort; + /** + * Hydrate result parameter object with generated assorts + * @param assortCount Number of assorts to generate + * @param assorts object to add assorts to + */ + protected createAssorts(assortCount: number, assorts: ITraderAssort): void; /** * Get the next update timestamp for fence * @returns future timestamp @@ -44,11 +106,14 @@ export declare class FenceService { */ protected getFenceRefreshTime(): number; /** - * Get the fence level the passed in profile has + * Get fence level the passed in profile has * @param pmcData Player profile - * @returns FenceLevel + * @returns FenceLevel object */ getFenceInfo(pmcData: IPmcData): FenceLevel; + /** + * Remove an assort from fence by id + * @param assortIdToRemove assort id to remove from fence assorts + */ removeFenceOffer(assortIdToRemove: string): void; - updateFenceOffers(pmcData: IPmcData): void; } diff --git a/Live/CWX_DebugTool/types/services/InsuranceService.d.ts b/Live/CWX_DebugTool/types/services/InsuranceService.d.ts index 171bf10..6be8a2f 100644 --- a/Live/CWX_DebugTool/types/services/InsuranceService.d.ts +++ b/Live/CWX_DebugTool/types/services/InsuranceService.d.ts @@ -2,6 +2,7 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { InsuredItem } from "../models/eft/common/tables/IBotBase"; import { Item } from "../models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; @@ -44,8 +45,22 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; + /** + * Store lost gear post-raid inside profile + * @param pmcData player profile to store gear in + * @param offraidData post-raid request object + * @param preRaidGear gear player wore prior to raid + * @param sessionID Session id + */ storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string): void; storeInsuredItemsForReturn(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string): void; - protected addGearToSend(pmcData: IPmcData, insuredItem: any, actualItem: any, sessionID: string): any; + /** + * Add gear item to InsuredItems array in player profile + * @param pmcData profile to store item in + * @param insuredItem Item to store in profile + * @param actualItem item to store + * @param sessionID Session id + */ + protected addGearToSend(pmcData: IPmcData, insuredItem: InsuredItem, actualItem: Item, sessionID: string): void; getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; } diff --git a/Live/CWX_DebugTool/types/services/ItemFilterService.d.ts b/Live/CWX_DebugTool/types/services/ItemFilterService.d.ts new file mode 100644 index 0000000..c9c8ef3 --- /dev/null +++ b/Live/CWX_DebugTool/types/services/ItemFilterService.d.ts @@ -0,0 +1,24 @@ +import { IItemConfig } from "../models/spt/config/IItemConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +/** Centralise the handling of blacklisting items, uses blacklist found in config/item.json */ +export declare class ItemFilterService { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected blacklist: string[]; + protected itemConfig: IItemConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Check if the provided template id is blacklisted in config/item.json + * @param tpl template id + * @returns true if blacklisted + */ + isItemBlacklisted(tpl: string): boolean; + /** + * Return every template id blacklisted in config/item.json + * @returns string array of blacklisted tempalte ids + */ + getBlacklistedItems(): string[]; +} diff --git a/Live/CWX_DebugTool/types/services/PmcAiService.d.ts b/Live/CWX_DebugTool/types/services/PmcAiService.d.ts new file mode 100644 index 0000000..0690f1f --- /dev/null +++ b/Live/CWX_DebugTool/types/services/PmcAiService.d.ts @@ -0,0 +1,27 @@ +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +/** Storing/retreving pmcRoles set at the start of a raid - its done at that point as we know what location the player is heading to */ +export declare class PmcAiService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + protected usecRole: string; + protected bearRole: string; + constructor(logger: ILogger, configServer: ConfigServer); + /** + * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) + * @param pmcSide eft side (usec/bear) + * @returns pmc side as defined in config + */ + getPmcRole(pmcSide: "usec" | "bear" | string): string; + /** + * Set the roles for pmcs + * @param location map location to look up and use as pmc types + */ + setPmcRolesByLocation(location: string): void; + /** + * Clear the saved role from usec/bear PMCs + */ + clearPmcRoles(): void; +} diff --git a/Live/CWX_DebugTool/types/services/ProfileFixerService.d.ts b/Live/CWX_DebugTool/types/services/ProfileFixerService.d.ts index ed1dec7..9cb5a38 100644 --- a/Live/CWX_DebugTool/types/services/ProfileFixerService.d.ts +++ b/Live/CWX_DebugTool/types/services/ProfileFixerService.d.ts @@ -45,6 +45,11 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to find and remove slots from */ protected removeResourcesFromSlotsInHideoutWithoutLocationIndexValue(pmcProfile: IPmcData): void; + /** + * Hideout slots need to be in a specific order, locationIndex in ascending order + * @param pmcProfile profile to edit + */ + protected reorderHideoutAreasWithResouceInputs(pmcProfile: IPmcData): void; /** * add in objects equal to the number of slots * @param areaType area to check diff --git a/Live/CWX_DebugTool/types/services/RepairService.d.ts b/Live/CWX_DebugTool/types/services/RepairService.d.ts new file mode 100644 index 0000000..3e6077c --- /dev/null +++ b/Live/CWX_DebugTool/types/services/RepairService.d.ts @@ -0,0 +1,75 @@ +import { QuestHelper } from "../helpers/QuestHelper"; +import { RepairHelper } from "../helpers/RepairHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { RepairKitsInfo } from "../models/eft/repair/IRepairActionDataRequest"; +import { RepairItem } from "../models/eft/repair/ITraderRepairActionDataRequest"; +import { IRepairConfig } from "../models/spt/config/IRepairConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ItemEventRouter } from "../routers/ItemEventRouter"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { PaymentService } from "./PaymentService"; +export declare class RepairService { + protected logger: ILogger; + protected itemEventRouter: ItemEventRouter; + protected databaseServer: DatabaseServer; + protected questHelper: QuestHelper; + protected traderHelper: TraderHelper; + protected paymentService: PaymentService; + protected repairHelper: RepairHelper; + protected configServer: ConfigServer; + repairConfig: IRepairConfig; + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + /** + * Use trader to repair an items durability + * @param sessionID Session id + * @param pmcData profile to find item to repair in + * @param repairItemDetails details of the item to repair + * @param traderId Trader being used to repair item + * @returns RepairDetails object + */ + repairItemByTrader(sessionID: string, pmcData: IPmcData, repairItemDetails: RepairItem, traderId: string): RepairDetails; + /** + * + * @param sessionID Session id + * @param pmcData profile to take money from + * @param repairedItemId Repaired item id + * @param repairCost Cost to repair item in roubles + * @param traderId Id of the trader who repaired the item / who is paid + * @param output + */ + payForRepair(sessionID: string, pmcData: IPmcData, repairedItemId: string, repairCost: number, traderId: string, output: IItemEventRouterResponse): void; + /** + * Add skill points to profile after repairing an item + * @param sessionId Session id + * @param repairDetails details of item repaired, cost/item + * @param pmcData Profile to add points to + * @param output IItemEventRouterResponse + */ + addRepairSkillPoints(sessionId: string, repairDetails: RepairDetails, pmcData: IPmcData, output: IItemEventRouterResponse): void; + /** + * + * @param sessionId Session id + * @param pmcData Profile to update repaired item in + * @param repairKits Array of Repair kits to use + * @param itemToRepairId Item id to repair + * @param output IItemEventRouterResponse + * @returns Details of repair, item/price + */ + repairItemByKit(sessionId: string, pmcData: IPmcData, repairKits: RepairKitsInfo[], itemToRepairId: string, output: IItemEventRouterResponse): RepairDetails; + /** + * Update repair kits Resource object if it doesn't exist + * @param repairKitDetails Repair kit details from db + * @param repairKitInInventory Repair kit to update + */ + protected addMaxResourceToKitIfMissing(repairKitDetails: ITemplateItem, repairKitInInventory: Item): void; +} +export declare class RepairDetails { + repairCost?: number; + repairedItem: Item; + repairedItemIsArmor: boolean; +} diff --git a/Live/CWX_DebugTool/types/utils/HashUtil.d.ts b/Live/CWX_DebugTool/types/utils/HashUtil.d.ts index bacbf2a..a8500e1 100644 --- a/Live/CWX_DebugTool/types/utils/HashUtil.d.ts +++ b/Live/CWX_DebugTool/types/utils/HashUtil.d.ts @@ -4,8 +4,18 @@ import { TimeUtil } from "./TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; constructor(timeUtil: TimeUtil); + /** + * Create a 24 character id using the sha256 algorithm + current timestamp + * @returns 24 character hash + */ generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + /** + * Create a hash for the data parameter + * @param algorithm algorithm to use to hash + * @param data data to be hashed + * @returns hash value + */ generateHashForData(algorithm: string, data: crypto.BinaryLike): string; } diff --git a/Live/CWX_DebugTool/types/utils/RandomUtil.d.ts b/Live/CWX_DebugTool/types/utils/RandomUtil.d.ts index c24dd60..633e472 100644 --- a/Live/CWX_DebugTool/types/utils/RandomUtil.d.ts +++ b/Live/CWX_DebugTool/types/utils/RandomUtil.d.ts @@ -136,7 +136,7 @@ export declare class RandomUtil { * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with ot without replacement from the input array + * @param {boolean} replacement Draw with or without replacement from the input array * @return {array} Array consisting of N random elements */ drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; @@ -150,4 +150,10 @@ export declare class RandomUtil { */ drawRandomFromDict(dict: any, count?: number, replacement?: boolean): any[]; getBiasedRandomNumber(min: number, max: number, shift: number, n: number): number; + /** + * Fisher-Yates shuffle an array + * @param array Array to shuffle + * @returns Shuffled array + */ + shuffle(array: Array): Array; } diff --git a/Live/CWX_DebugTool/types/utils/TimeUtil.d.ts b/Live/CWX_DebugTool/types/utils/TimeUtil.d.ts index f437f8a..1367e26 100644 --- a/Live/CWX_DebugTool/types/utils/TimeUtil.d.ts +++ b/Live/CWX_DebugTool/types/utils/TimeUtil.d.ts @@ -1,3 +1,6 @@ +/** + * Utility class to handle time related problems + */ export declare class TimeUtil { static readonly oneHourAsSeconds = 3600; formatTime(date: Date): string; @@ -19,4 +22,10 @@ export declare class TimeUtil { * @returns current date in format: 00.00.0000 (dd.mm.yyyy) */ getDateMailFormat(): string; + /** + * Convert hours into seconds + * @param hours hours to convert to seconds + * @returns number + */ + getHoursAsSeconds(hours: number): number; } diff --git a/Live/CWX_MasterKey/CWX_MasterKey 1.3.4/bepInEx/plugins/CWX-MasterKey.dll b/Live/CWX_MasterKey/CWX_MasterKey 1.3.5/bepInEx/plugins/CWX-MasterKey.dll similarity index 73% rename from Live/CWX_MasterKey/CWX_MasterKey 1.3.4/bepInEx/plugins/CWX-MasterKey.dll rename to Live/CWX_MasterKey/CWX_MasterKey 1.3.5/bepInEx/plugins/CWX-MasterKey.dll index 6f271fa..f57a5ec 100644 Binary files a/Live/CWX_MasterKey/CWX_MasterKey 1.3.4/bepInEx/plugins/CWX-MasterKey.dll and b/Live/CWX_MasterKey/CWX_MasterKey 1.3.5/bepInEx/plugins/CWX-MasterKey.dll differ diff --git a/Live/CWX_MasterKey/CWX_MasterKey 1.3.4/user/mods/CWX-MasterKeys 1.3.4/LICENSE.txt b/Live/CWX_MasterKey/CWX_MasterKey 1.3.5/user/mods/CWX-MasterKey 1.3.5/LICENSE.txt similarity index 100% rename from Live/CWX_MasterKey/CWX_MasterKey 1.3.4/user/mods/CWX-MasterKeys 1.3.4/LICENSE.txt rename to Live/CWX_MasterKey/CWX_MasterKey 1.3.5/user/mods/CWX-MasterKey 1.3.5/LICENSE.txt diff --git a/Live/CWX_MasterKey/CWX_MasterKey 1.3.4/user/mods/CWX-MasterKeys 1.3.4/package.json b/Live/CWX_MasterKey/CWX_MasterKey 1.3.5/user/mods/CWX-MasterKey 1.3.5/package.json similarity index 95% rename from Live/CWX_MasterKey/CWX_MasterKey 1.3.4/user/mods/CWX-MasterKeys 1.3.4/package.json rename to Live/CWX_MasterKey/CWX_MasterKey 1.3.5/user/mods/CWX-MasterKey 1.3.5/package.json index af9e2c7..5ec29d5 100644 --- a/Live/CWX_MasterKey/CWX_MasterKey 1.3.4/user/mods/CWX-MasterKeys 1.3.4/package.json +++ b/Live/CWX_MasterKey/CWX_MasterKey 1.3.5/user/mods/CWX-MasterKey 1.3.5/package.json @@ -1,10 +1,10 @@ { "name": "MasterKey", "author": "CWX", - "version": "1.3.4", + "version": "1.3.5", "license": "NCSA", "main": "src/mod.js", - "akiVersion": "3.2.2", + "akiVersion": "3.2.3", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" ./**/*.* ./dist", diff --git a/Live/CWX_MasterKey/CWX_MasterKey 1.3.4/user/mods/CWX-MasterKeys 1.3.4/src/mod.ts b/Live/CWX_MasterKey/CWX_MasterKey 1.3.5/user/mods/CWX-MasterKey 1.3.5/src/mod.ts similarity index 100% rename from Live/CWX_MasterKey/CWX_MasterKey 1.3.4/user/mods/CWX-MasterKeys 1.3.4/src/mod.ts rename to Live/CWX_MasterKey/CWX_MasterKey 1.3.5/user/mods/CWX-MasterKey 1.3.5/src/mod.ts diff --git a/Live/CWX_MasterKey/CWX_MasterKey.csproj b/Live/CWX_MasterKey/CWX_MasterKey.csproj index f5b1ca4..9de0a60 100644 --- a/Live/CWX_MasterKey/CWX_MasterKey.csproj +++ b/Live/CWX_MasterKey/CWX_MasterKey.csproj @@ -4,7 +4,7 @@ net472 CWX_MasterKey CWX-MasterKey - 1.2.0 + 1.3.5 diff --git a/Live/CWX_MasterKey/README.md b/Live/CWX_MasterKey/README.md index 14777a2..2253f76 100644 --- a/Live/CWX_MasterKey/README.md +++ b/Live/CWX_MasterKey/README.md @@ -1,5 +1,5 @@ # MasterKey ## CWX-MASTERKEY for EFT - SPT-AKI -### CURRENT AKI VERSION: 2.3.0 -### GAMEVERSION: 0.12.12.16909 +### CURRENT AKI VERSION: 3.2.3 +### GAMEVERSION: 0.12.12.31.19428 ### USING BEPINEX diff --git a/Live/CWX_MasterKey/program.cs b/Live/CWX_MasterKey/program.cs index 3a3d1e9..ab73b19 100644 --- a/Live/CWX_MasterKey/program.cs +++ b/Live/CWX_MasterKey/program.cs @@ -2,7 +2,7 @@ namespace CWX_MasterKey { - [BepInPlugin("com.CWX.MasterKey", "CWX-MasterKey", "1.3.0")] + [BepInPlugin("com.CWX.MasterKey", "CWX-MasterKey", "1.3.5")] public class Plugin : BaseUnityPlugin { private void Awake() diff --git a/Live/CWX_MasterKey/server/dist/package.json b/Live/CWX_MasterKey/server/dist/package.json index af9e2c7..5ec29d5 100644 --- a/Live/CWX_MasterKey/server/dist/package.json +++ b/Live/CWX_MasterKey/server/dist/package.json @@ -1,10 +1,10 @@ { "name": "MasterKey", "author": "CWX", - "version": "1.3.4", + "version": "1.3.5", "license": "NCSA", "main": "src/mod.js", - "akiVersion": "3.2.2", + "akiVersion": "3.2.3", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" ./**/*.* ./dist", diff --git a/Live/CWX_MasterKey/server/dist/types/callbacks/InsuranceCallbacks.d.ts b/Live/CWX_MasterKey/server/dist/types/callbacks/InsuranceCallbacks.d.ts index 6819960..8835ba2 100644 --- a/Live/CWX_MasterKey/server/dist/types/callbacks/InsuranceCallbacks.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/callbacks/InsuranceCallbacks.d.ts @@ -1,5 +1,5 @@ import { InsuranceController } from "../controllers/InsuranceController"; -import { OnLoadOnUpdate } from "../di/OnLoadOnUpdate"; +import { OnUpdate } from "../di/OnUpdate"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData"; @@ -10,14 +10,13 @@ import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { InsuranceService } from "../services/InsuranceService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -export declare class InsuranceCallbacks extends OnLoadOnUpdate { +export declare class InsuranceCallbacks extends OnUpdate { protected insuranceController: InsuranceController; protected insuranceService: InsuranceService; protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); - onLoad(): void; getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; diff --git a/Live/CWX_MasterKey/server/dist/types/callbacks/LocationCallbacks.d.ts b/Live/CWX_MasterKey/server/dist/types/callbacks/LocationCallbacks.d.ts index cc69369..6e0b538 100644 --- a/Live/CWX_MasterKey/server/dist/types/callbacks/LocationCallbacks.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/callbacks/LocationCallbacks.d.ts @@ -11,4 +11,5 @@ export declare class LocationCallbacks { constructor(httpResponse: HttpResponseUtil, locationController: LocationController); getLocationData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocation(url: string, info: IGetLocationRequestData, sessionID: string): IGetBodyResponseData; + getAirdropLoot(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/Live/CWX_MasterKey/server/dist/types/callbacks/ProfileCallbacks.d.ts b/Live/CWX_MasterKey/server/dist/types/callbacks/ProfileCallbacks.d.ts index 6a86fc0..183bb0a 100644 --- a/Live/CWX_MasterKey/server/dist/types/callbacks/ProfileCallbacks.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/callbacks/ProfileCallbacks.d.ts @@ -1,5 +1,6 @@ import { ProfileController } from "../controllers/ProfileController"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IGetMiniProfileRequestData } from "../models/eft/launcher/IGetMiniProfileRequestData"; @@ -12,20 +13,51 @@ import { ISearchFriendResponse } from "../models/eft/profile/ISearchFriendRespon import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** Handle profile related client events */ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); createProfile(url: string, info: IProfileCreateRequestData, sessionID: string): IGetBodyResponseData; - getProfileData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - regenerateScav(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Get the complete player profile (scav + pmc character) + * @param url + * @param info Empty + * @param sessionID Session id + * @returns Profile object + */ + getProfileData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle the creation of a scav profile for player + * Occurs post-raid and when profile first created immediately after character details are confirmed by player + * @param url + * @param info empty + * @param sessionID Session id + * @returns Profile object + */ + regenerateScav(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/profile/voice/change event + * @param url + * @param info Change voice request object + * @param sessionID Session id + * @returns Client response + */ changeVoice(url: string, info: IProfileChangeVoiceRequestData, sessionID: string): INullResponseData; + /** + * Handle client/game/profile/nickname/change event + * Client allows player to adjust their profile name + * @param url + * @param info Change nickname request object + * @param sessionID Session id + * @returns client response + */ changeNickname(url: string, info: IProfileChangeNicknameRequestData, sessionID: string): IGetBodyResponseData; validateNickname(url: string, info: IValidateNicknameRequestData, sessionID: string): IGetBodyResponseData; getReservedNickname(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** - * Called when creating a character, when you choose a character face/voice + * Called when creating a character when choosing a character face/voice * @param url * @param info response (empty) * @param sessionID diff --git a/Live/CWX_MasterKey/server/dist/types/callbacks/RagfairCallbacks.d.ts b/Live/CWX_MasterKey/server/dist/types/callbacks/RagfairCallbacks.d.ts index 3a405c9..c609f2f 100644 --- a/Live/CWX_MasterKey/server/dist/types/callbacks/RagfairCallbacks.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/callbacks/RagfairCallbacks.d.ts @@ -19,6 +19,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; +/** + * Handle ragfair related callback events + */ export declare class RagfairCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; protected logger: ILogger; diff --git a/Live/CWX_MasterKey/server/dist/types/callbacks/RepairCallbacks.d.ts b/Live/CWX_MasterKey/server/dist/types/callbacks/RepairCallbacks.d.ts index 63733fa..14edeeb 100644 --- a/Live/CWX_MasterKey/server/dist/types/callbacks/RepairCallbacks.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/callbacks/RepairCallbacks.d.ts @@ -6,6 +6,20 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa export declare class RepairCallbacks { protected repairController: RepairController; constructor(repairController: RepairController); + /** + * use trader to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + /** + * Use repair kit to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ repair(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/Live/CWX_MasterKey/server/dist/types/callbacks/TraderCallbacks.d.ts b/Live/CWX_MasterKey/server/dist/types/callbacks/TraderCallbacks.d.ts index 128d9b2..e4fd099 100644 --- a/Live/CWX_MasterKey/server/dist/types/callbacks/TraderCallbacks.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/callbacks/TraderCallbacks.d.ts @@ -9,10 +9,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); onLoad(): void; + onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - onUpdate(): boolean; } diff --git a/Live/CWX_MasterKey/server/dist/types/context/ContextVariable.d.ts b/Live/CWX_MasterKey/server/dist/types/context/ContextVariable.d.ts index e438947..0fe0a63 100644 --- a/Live/CWX_MasterKey/server/dist/types/context/ContextVariable.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/context/ContextVariable.d.ts @@ -4,7 +4,7 @@ export declare class ContextVariable { private timestamp; private type; constructor(value: any, type: ContextVariableType); - getValue(): any; + getValue(): T; getTimestamp(): Date; getType(): ContextVariableType; } diff --git a/Live/CWX_MasterKey/server/dist/types/controllers/BotController.d.ts b/Live/CWX_MasterKey/server/dist/types/controllers/BotController.d.ts index 5e6f05d..a5111d5 100644 --- a/Live/CWX_MasterKey/server/dist/types/controllers/BotController.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/controllers/BotController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotHelper } from "../helpers/BotHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; @@ -5,15 +6,22 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { IBotCore } from "../models/eft/common/tables/IBotCore"; import { Difficulty } from "../models/eft/common/tables/IBotType"; import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; +import { PmcAiService } from "../services/PmcAiService"; export declare class BotController { + protected logger: ILogger; protected databaseServer: DatabaseServer; protected botGenerator: BotGenerator; protected botHelper: BotHelper; + protected pmcAiService: PmcAiService; + protected botGenerationCacheService: BotGenerationCacheService; protected configServer: ConfigServer; + protected applicationContext: ApplicationContext; protected botConfig: IBotConfig; - constructor(databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -29,7 +37,18 @@ export declare class BotController { * @returns Difficulty object */ getBotDifficulty(type: string, difficulty: string): Difficulty; - protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string): Difficulty; + protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Generate bot profiles and store in cache + * @param sessionId Session id + * @param info bot generation request info + * @returns IBotBase array + */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the max number of bots allowed on a map + * Looks up location player is entering when getting cap value + * @returns cap number + */ getBotCap(): number; } diff --git a/Live/CWX_MasterKey/server/dist/types/controllers/GameController.d.ts b/Live/CWX_MasterKey/server/dist/types/controllers/GameController.d.ts index 85ec418..2d00898 100644 --- a/Live/CWX_MasterKey/server/dist/types/controllers/GameController.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/controllers/GameController.d.ts @@ -7,11 +7,13 @@ import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; protected localeService: LocaleService; @@ -20,9 +22,14 @@ export declare class GameController { protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + /** + * Make non-trigger-spawned raiders spawn earlier + always + */ + protected adjustLabsRaiderSpawnRate(): void; protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; + getValidGameVersion(): any; } diff --git a/Live/CWX_MasterKey/server/dist/types/controllers/HideoutController.d.ts b/Live/CWX_MasterKey/server/dist/types/controllers/HideoutController.d.ts index 3eefe1a..dcd8894 100644 --- a/Live/CWX_MasterKey/server/dist/types/controllers/HideoutController.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/controllers/HideoutController.d.ts @@ -28,6 +28,7 @@ import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,9 +46,10 @@ export declare class HideoutController { protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/Live/CWX_MasterKey/server/dist/types/controllers/InraidController.d.ts b/Live/CWX_MasterKey/server/dist/types/controllers/InraidController.d.ts index b899e7d..102a2fb 100644 --- a/Live/CWX_MasterKey/server/dist/types/controllers/InraidController.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/controllers/InraidController.d.ts @@ -5,9 +5,11 @@ import { ItemHelper } from "../helpers/ItemHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; @@ -15,6 +17,7 @@ import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class InraidController { + protected logger: ILogger; protected saveServer: SaveServer; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; @@ -29,16 +32,40 @@ export declare class InraidController { protected inRaidHelper: InRaidHelper; protected configServer: ConfigServer; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Handle updating the profile post-pmc raid + * @param sessionID session id + * @param offraidData post-raid data of raid + */ + protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Reduce body part hp to % of max + * @param pmcData profile to edit + * @param multipler multipler to apply to max health + */ + protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + /** + * Handle updating the profile post-pscav raid + * @param sessionID session id + * @param offraidData post-raid data of raid + */ + protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Is the player dead after a raid - dead is anything other than "survived" / "runner" + * @param statusOnExit exit value from offraidData object + * @returns true if dead + */ + protected isPlayerDead(statusOnExit: string): boolean; /** * Mark inventory items as FiR if player survived raid, otherwise remove FiR from them * @param offraidData Save Progress Request * @param pmcData player profile * @param isPlayerScav Was the player a pScav */ - private markOrRemoveFoundInRaidItems; - private handlePostRaidPlayerScavProcess; - private handlePostRaidPlayerScavKarmaChanges; + protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; } diff --git a/Live/CWX_MasterKey/server/dist/types/controllers/InventoryController.d.ts b/Live/CWX_MasterKey/server/dist/types/controllers/InventoryController.d.ts index f57f731..f564919 100644 --- a/Live/CWX_MasterKey/server/dist/types/controllers/InventoryController.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/controllers/InventoryController.d.ts @@ -92,7 +92,11 @@ export declare class InventoryController { */ toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; /** - * Handles Tagging of items (primary Containers). + * Add a tag to an inventory item + * @param pmcData profile with item to add tag to + * @param body tag request data + * @param sessionID session id + * @returns client response object */ tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/Live/CWX_MasterKey/server/dist/types/controllers/LocationController.d.ts b/Live/CWX_MasterKey/server/dist/types/controllers/LocationController.d.ts index 90b6d7a..9db3205 100644 --- a/Live/CWX_MasterKey/server/dist/types/controllers/LocationController.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/controllers/LocationController.d.ts @@ -1,18 +1,33 @@ import { LocationGenerator } from "../generators/LocationGenerator"; +import { LootGenerator } from "../generators/LootGenerator"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; +import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; +import { LootItem } from "../models/spt/services/LootItem"; import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class LocationController { protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected logger: ILogger; protected locationGenerator: LocationGenerator; + protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; - constructor(jsonUtil: JsonUtil, logger: ILogger, locationGenerator: LocationGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil); + protected configServer: ConfigServer; + protected airdropConfig: IAirdropConfig; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; generateAll(): ILocationsGenerateAllResponse; + /** + * Get loot for an airdop container + * Generates it randomly based on config/airdrop.json values + * @returns Array of LootItem + */ + getAirdropLoot(): LootItem[]; } diff --git a/Live/CWX_MasterKey/server/dist/types/controllers/MatchController.d.ts b/Live/CWX_MasterKey/server/dist/types/controllers/MatchController.d.ts index 71cb7d3..07f6a89 100644 --- a/Live/CWX_MasterKey/server/dist/types/controllers/MatchController.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/controllers/MatchController.d.ts @@ -9,23 +9,33 @@ import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestDa import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; +import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { PmcAiService } from "../services/PmcAiService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { + protected logger: ILogger; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected matchLocationService: MatchLocationService; protected traderHelper: TraderHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; + protected profileSnapshotService: ProfileSnapshotService; + protected pmcAiService: PmcAiService; + protected botGenerationCacheService: BotGenerationCacheService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + protected botConfig: IBotConfig; + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/Live/CWX_MasterKey/server/dist/types/controllers/QuestController.d.ts b/Live/CWX_MasterKey/server/dist/types/controllers/QuestController.d.ts index 2cbccfb..282f50e 100644 --- a/Live/CWX_MasterKey/server/dist/types/controllers/QuestController.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/controllers/QuestController.d.ts @@ -39,16 +39,31 @@ export declare class QuestController { * @returns array of IQuest */ getClientQuests(sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param side player side (usec/bear) + * @param questId questId to check + */ + protected questIsForOtherSide(side: string, questId: string): boolean; + /** + * Handle the client accepting a quest and starting it + * Send starting rewards if any to player and + * Send start notification if any to player + * @param pmcData Profile to update + * @param acceptedQuest Quest accepted + * @param sessionID Session id + * @returns client response + */ acceptQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; acceptRepeatableQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; /** - * Remove completed quest from profile + * Update completed quest in profile * Add newly unlocked quests to profile * Also recalculate thier level due to exp rewards * @param pmcData Player profile - * @param body completed quest request - * @param sessionID session id - * @returns ItemEvent response + * @param body Completed quest request + * @param sessionID Session id + * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -67,10 +82,20 @@ export declare class QuestController { protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the quests provided + * Update quest in profile, otherwise add fresh quest object with failed status * @param sessionID session id * @param pmcData player profile * @param questsToFail quests to fail */ protected failQuests(sessionID: string, pmcData: IPmcData, questsToFail: IQuest[]): void; handoverQuest(pmcData: IPmcData, body: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Increment a backend counter stored value by an amount, + * Create counter if it does not exist + * @param pmcData Profile to find backend counter in + * @param conditionId backend counter id to update + * @param questId quest id counter is associated with + * @param counterValue value to increment the backend counter with + */ + protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; } diff --git a/Live/CWX_MasterKey/server/dist/types/controllers/RagfairController.d.ts b/Live/CWX_MasterKey/server/dist/types/controllers/RagfairController.d.ts index c4ffc15..06af740 100644 --- a/Live/CWX_MasterKey/server/dist/types/controllers/RagfairController.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/controllers/RagfairController.d.ts @@ -9,6 +9,7 @@ import { RagfairOfferHelper } from "../helpers/RagfairOfferHelper"; import { RagfairSellHelper } from "../helpers/RagfairSellHelper"; import { RagfairSortHelper } from "../helpers/RagfairSortHelper"; import { RagfairTaxHelper } from "../helpers/RagfairTaxHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; @@ -33,6 +34,9 @@ import { RagfairPriceService } from "../services/RagfairPriceService"; import { RagfairRequiredItemsService } from "../services/RagfairRequiredItemsService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** + * Handle RagfairCallback events + */ export declare class RagfairController { protected logger: ILogger; protected timeUtil: TimeUtil; @@ -52,14 +56,20 @@ export declare class RagfairController { protected handbookHelper: HandbookHelper; protected paymentHelper: PaymentHelper; protected inventoryHelper: InventoryHelper; + protected traderHelper: TraderHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected ragfairOfferGenerator: RagfairOfferGenerator; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + /** + * Update a trader flea offer with buy restrictions stored in the traders assort + * @param offer flea offer to update + */ + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer): void; protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; diff --git a/Live/CWX_MasterKey/server/dist/types/controllers/RepairController.d.ts b/Live/CWX_MasterKey/server/dist/types/controllers/RepairController.d.ts index 0e78ef6..ae54a53 100644 --- a/Live/CWX_MasterKey/server/dist/types/controllers/RepairController.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/controllers/RepairController.d.ts @@ -8,9 +8,9 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa import { IRepairConfig } from "../models/spt/config/IRepairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; -import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { PaymentService } from "../services/PaymentService"; +import { RepairService } from "../services/RepairService"; export declare class RepairController { protected logger: ILogger; protected itemEventRouter: ItemEventRouter; @@ -19,23 +19,23 @@ export declare class RepairController { protected traderHelper: TraderHelper; protected paymentService: PaymentService; protected repairHelper: RepairHelper; - protected configServer: ConfigServer; + protected repairService: RepairService; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); /** * Repair with trader - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + traderRepair(sessionID: string, body: ITraderRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; /** * Repair with repair kit - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - repairWithKit(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + repairWithKit(sessionID: string, body: IRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; } diff --git a/Live/CWX_MasterKey/server/dist/types/controllers/RepeatableQuestController.d.ts b/Live/CWX_MasterKey/server/dist/types/controllers/RepeatableQuestController.d.ts index 98d05dd..4c31a3d 100644 --- a/Live/CWX_MasterKey/server/dist/types/controllers/RepeatableQuestController.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/controllers/RepeatableQuestController.d.ts @@ -7,6 +7,7 @@ import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; import { TraderInfo } from "../models/eft/common/tables/IBotBase"; import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; import { ELocationName } from "../models/enums/ELocationName"; @@ -15,6 +16,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -64,9 +66,10 @@ export declare class RepeatableQuestController { protected itemEventRouter: ItemEventRouter; protected paymentService: PaymentService; protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. @@ -217,4 +220,16 @@ export declare class RepeatableQuestController { debugLogRepeatableQuestIds(pmcData: IPmcData): void; probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; changeRepeatableQuest(pmcDataIn: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {*} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; } diff --git a/Live/CWX_MasterKey/server/dist/types/controllers/TraderController.d.ts b/Live/CWX_MasterKey/server/dist/types/controllers/TraderController.d.ts index 7bab158..b79f55e 100644 --- a/Live/CWX_MasterKey/server/dist/types/controllers/TraderController.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/controllers/TraderController.d.ts @@ -4,6 +4,7 @@ import { TraderHelper } from "../helpers/TraderHelper"; import { IBarterScheme, ITraderAssort, ITraderBase } from "../models/eft/common/tables/ITrader"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -15,12 +16,29 @@ export declare class TraderController { protected traderHelper: TraderHelper; protected timeUtil: TimeUtil; protected traderAssortService: TraderAssortService; + protected fenceService: FenceService; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, fenceService: FenceService, jsonUtil: JsonUtil); + /** + * Runs when onLoad event is fired + * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Store timestamp of next assort refresh in nextResupply property of traders .base object + */ load(): void; - getTrader(traderID: string, sessionID: string): ITraderBase; + /** + * Runs when onUpdate is fired + * If current time is > nextResupply(expire) time of trader, refresh traders assorts and + * Fence is handled slightly differently + * @returns has run + */ + update(): boolean; + /** + * Return an array of all traders + * @param sessionID Session id + * @returns array if ITraderBase objects + */ getAllTraders(sessionID: string): ITraderBase[]; - updateTraders(): boolean; + getTrader(sessionID: string, traderID: string): ITraderBase; getAssort(sessionId: string, traderId: string): ITraderAssort; - getPurchasesData(traderID: string, sessionID: string): Record; + getPurchasesData(sessionID: string, traderID: string): Record; } diff --git a/Live/CWX_MasterKey/server/dist/types/di/Container.d.ts b/Live/CWX_MasterKey/server/dist/types/di/Container.d.ts index 17791b0..98d1fa1 100644 --- a/Live/CWX_MasterKey/server/dist/types/di/Container.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/di/Container.d.ts @@ -1,4 +1,7 @@ import { DependencyContainer } from "tsyringe"; +/** + * Handle the registration of classes to be used by the Dependency Injection code + */ export declare class Container { static registerTypes(depContainer: DependencyContainer): void; static registerListTypes(depContainer: DependencyContainer): void; diff --git a/Live/CWX_MasterKey/server/dist/types/generators/BotGenerator.d.ts b/Live/CWX_MasterKey/server/dist/types/generators/BotGenerator.d.ts index a5fc0ad..2ac51db 100644 --- a/Live/CWX_MasterKey/server/dist/types/generators/BotGenerator.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/generators/BotGenerator.d.ts @@ -9,6 +9,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { PmcAiService } from "../services/PmcAiService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -30,9 +31,10 @@ export declare class BotGenerator { protected botEquipmentFilterService: BotEquipmentFilterService; protected botHelper: BotHelper; protected gameEventHelper: GameEventHelper; + protected pmcAiService: PmcAiService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, pmcAiService: PmcAiService, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -40,14 +42,14 @@ export declare class BotGenerator { * @param botTemplate base bot template to use (e.g. assault/pmcbot) * @returns */ - generatePlayerScav(role: string, difficulty: string, botTemplate: IBotType): IBotBase; - generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Choose if a bot should become a PMC by checking if bot type is allowed to become a Pmc in botConfig.convertFromChances and doing a random int check - * @param botRole the bot role to check if should be a pmc - * @returns true if should be a pmc + * Generate an array of bot objects for populate a raid with + * @param sessionId session id + * @param info request object + * @returns bot array */ - protected shouldBotBePmc(botRole: string): boolean; + generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** * Get a randomised PMC side based on bot config value 'isUsec' * @returns pmc side as string @@ -58,12 +60,30 @@ export declare class BotGenerator { * @returns IBotBase object */ protected getCloneOfBotBase(): IBotBase; - protected generateBot(bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + /** + * Create a IBotBase object with equipment/loot/exp etc + * @param sessionId Session id + * @param bot bots base file + * @param role botRole bot will use + * @param node Bot template from db/bots/x.json + * @param isPmc Is bot to be a PMC + * @param isPlayerScav is bot to be a p scav bot + * @returns IBotBase object + */ + protected generateBot(sessionId: string, bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; /** * Log the number of PMCs generated to the debug console + * @param output Generated bot array, ready to send to client */ protected logPmcGeneratedCount(output: IBotBase[]): void; - protected generateRandomLevel(min: number, max: number): BotGenerator.IRandomisedBotLevelResult; + /** + * Return a randomised bot level and exp value + * @param role botRole being generated for + * @param min Min exp value + * @param max Max exp value + * @returns IRandomisedBotLevelResult object + */ + protected generateRandomLevel(role: string, min: number, max: number): BotGenerator.IRandomisedBotLevelResult; /** * Converts health object to the required format * @param healthObj health object from bot json @@ -72,19 +92,23 @@ export declare class BotGenerator { */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; protected generateSkills(skillsObj: Skills): Skills; - /** - * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) - * @param pmcSide eft side (usec/bear) - * @returns pmc side as defined in config - */ - protected getPmcRole(pmcSide: string): string; /** * Iterate through bots inventory and loot to find and remove christmas items (as defined in GameEventHelper) * @param nodeInventory Bots inventory to iterate over */ protected removeChristmasItemsFromBotInventory(nodeInventory: Inventory): void; + /** + * Generate a random Id for a bot and apply to bots _id and aid value + * @param bot bot to update + * @returns updated IBotBase object + */ protected generateId(bot: IBotBase): IBotBase; protected generateInventoryID(profile: IBotBase): IBotBase; + /** + * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * @param requestedDifficulty + * @returns + */ protected getPMCDifficulty(requestedDifficulty: string): string; /** * Add a side-specific (usec/bear) dogtag item to a bots inventory diff --git a/Live/CWX_MasterKey/server/dist/types/generators/BotInventoryGenerator.d.ts b/Live/CWX_MasterKey/server/dist/types/generators/BotInventoryGenerator.d.ts index 35d1ee8..c5ed545 100644 --- a/Live/CWX_MasterKey/server/dist/types/generators/BotInventoryGenerator.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/generators/BotInventoryGenerator.d.ts @@ -1,13 +1,16 @@ +import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Inventory, Chances, Generation, Mods } from "../models/eft/common/tables/IBotType"; +import { Chances, Generation, Inventory, Mods } from "../models/eft/common/tables/IBotType"; +import { EquipmentSlots } from "../models/enums/EquipmentSlots"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; -import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; -import { BotWeaponGenerator } from "./BotWeaponGenerator"; import { BotLootGenerator } from "./BotLootGenerator"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; +import { BotWeaponGenerator } from "./BotWeaponGenerator"; export declare class BotInventoryGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -17,8 +20,14 @@ export declare class BotInventoryGenerator { protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper); - generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { + slot: EquipmentSlots; + shouldSpawn: boolean; + }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; protected generateInventoryBase(): PmcInventory; } diff --git a/Live/CWX_MasterKey/server/dist/types/generators/BotLootGenerator.d.ts b/Live/CWX_MasterKey/server/dist/types/generators/BotLootGenerator.d.ts index c6a3f29..c1f5310 100644 --- a/Live/CWX_MasterKey/server/dist/types/generators/BotLootGenerator.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/generators/BotLootGenerator.d.ts @@ -1,4 +1,5 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; @@ -20,11 +21,12 @@ export declare class BotLootGenerator { protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botLootCacheService: BotLootCacheService, configServer: ConfigServer); - generateLoot(templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer); + generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached @@ -47,7 +49,7 @@ export declare class BotLootGenerator { * @param botRole bots role, .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; /** * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from diff --git a/Live/CWX_MasterKey/server/dist/types/generators/BotWeaponGenerator.d.ts b/Live/CWX_MasterKey/server/dist/types/generators/BotWeaponGenerator.d.ts index 9215214..487901b 100644 --- a/Live/CWX_MasterKey/server/dist/types/generators/BotWeaponGenerator.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/generators/BotWeaponGenerator.d.ts @@ -1,4 +1,5 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { MinMax } from "../models/common/MinMax"; @@ -14,6 +15,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { IInventoryMagGen } from "./weapongen/IInventoryMagGen"; export declare class BotWeaponGenerator { protected jsonUtil: JsonUtil; protected logger: ILogger; @@ -24,11 +26,24 @@ export declare class BotWeaponGenerator { protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; protected configServer: ConfigServer; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, inventoryMagGenComponents: IInventoryMagGen[]); /** - * Get a random weapon from a bots pool of weapons (weighted) + * Pick a random weapon based on weightings and generate a functional weapon + * @param equipmentSlot Primary/secondary/holster + * @param botTemplateInventory e.g. assault.json + * @param weaponParentId + * @param modChances + * @param botRole role of bot, e.g. assault/followerBully + * @param isPmc Is weapon generated for a pmc + * @returns GenerateWeaponResult object + */ + generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + /** + * Get a random weighted weapon from a bots pool of weapons * @param equipmentSlot Primary/secondary/holster * @param botTemplateInventory e.g. assault.json * @returns weapon tpl @@ -39,43 +54,24 @@ export declare class BotWeaponGenerator { * @param weaponTpl weapon tpl to generate (use pickWeightedWeaponTplFromPool()) * @param equipmentSlot slot to fit into, primary/secondary/holster * @param botTemplateInventory e.g. assault.json - * @param weaponParentId - * @param modChances - * @param botRole + * @param weaponParentId ParentId of the weapon being generated + * @param modChances Dictionary of item types and % chance weapon will have that mod + * @param botRole e.g. assault/exusec * @param isPmc * @returns GenerateWeaponResult object */ - generateWeaponByTpl(weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; /** - * Generate an entirely random weapon - * @param equipmentSlot Primary/secondary/holster - * @param botTemplateInventory e.g. assault.json - * @param weaponParentId - * @param modChances - * @param botRole - * @param isPmc - * @returns GenerateWeaponResult object - */ - generateRandomWeapon(equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; - /** - * Create array with weapon base as only element - * Add additional properties as required - * @param weaponTpl - * @param weaponParentId - * @param equipmentSlot - * @param weaponItemTemplate + * Create array with weapon base as only element and + * add additional properties based on weapon type + * @param weaponTpl Weapon tpl to create item with + * @param weaponParentId Weapons parent id + * @param equipmentSlot e.g. primary/secondary/holster + * @param weaponItemTemplate db template for weapon * @param botRole for durability values - * @returns + * @returns Base weapon item in array */ - constructWeaponBaseArray(weaponTpl: string, weaponParentId: string, equipmentSlot: string, weaponItemTemplate: ITemplateItem, botRole: string): Item[]; - /** - * Add compatible magazines to an inventory based on a generated weapon - * @param weaponDetails - * @param magCounts - * @param inventory - * @param botRole the bot type we're getting generating extra mags for - */ - addExtraMagazinesToInventory(weaponDetails: GenerateWeaponResult, magCounts: MinMax, inventory: PmcInventory, botRole: string): void; + protected constructWeaponBaseArray(weaponTpl: string, weaponParentId: string, equipmentSlot: string, weaponItemTemplate: ITemplateItem, botRole: string): Item[]; /** * Get the mods necessary to kit out a weapon to its preset level * @param weaponTpl weapon to find preset for @@ -84,33 +80,21 @@ export declare class BotWeaponGenerator { * @returns array of weapon mods */ protected getPresetWeaponMods(weaponTpl: string, equipmentSlot: string, weaponParentId: string, itemTemplate: ITemplateItem, botRole: string): Item[]; - /** Checks if all required slots are occupied on a weapon and all it's mods */ + /** + * Checks if all required slots are occupied on a weapon and all it's mods + * @param weaponItemArray Weapon + mods + * @returns true if valid + */ protected isWeaponValid(weaponItemArray: Item[]): boolean; /** * Generates extra magazines or bullets (if magazine is internal) and adds them to TacticalVest and Pockets. * Additionally, adds extra bullets to SecuredContainer - * @param weaponMods - * @param weaponTemplate - * @param magCounts - * @param ammoTpl - * @param inventory - * @param botRole the bot type we're getting generating extra mags for - * @returns + * @param generatedWeaponResult object with properties for generated weapon (weapon mods pool / weapon template / ammo tpl) + * @param magCounts Magazine count to add to inventory + * @param inventory Inventory to add magazines to + * @param botRole The bot type we're getting generating extra mags for */ - protected generateExtraMagazines(weaponMods: Item[], weaponTemplate: ITemplateItem, magCounts: MinMax, ammoTpl: string, inventory: PmcInventory, botRole: string): void; - /** - * Get a randomised number of bullets for a specific magazine - * @param magCounts min and max count of magazines - * @param magTemplate magazine to generate bullet count for - * @returns bullet count number - */ - protected getRandomisedBulletCount(magCounts: MinMax, magTemplate: ITemplateItem): number; - /** - * Get a randomised count of magazines - * @param magCounts min and max value returned value can be between - * @returns numberical value of magazine count - */ - protected getRandomisedMagazineCount(magCounts: MinMax): number; + addExtraMagazinesToInventory(generatedWeaponResult: GenerateWeaponResult, magCounts: MinMax, inventory: PmcInventory, botRole: string): void; /** * Add ammo to the secure container * @param stackCount How many stacks of ammo to add @@ -127,21 +111,13 @@ export declare class BotWeaponGenerator { * @returns magazine tpl string */ protected getMagazineTplFromWeaponTemplate(weaponMods: Item[], weaponTemplate: ITemplateItem, botRole: string): string; - /** - * Get a weapons default magazine template id - * @param weaponTemplate weapon to get default magazine for - * @returns tpl of magazine - */ - protected getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - protected addBulletsToVestAndPockets(ammoTpl: string, bulletCount: number, inventory: PmcInventory): void; /** * Finds and return a compatible ammo tpl based on the bots ammo weightings (x.json/inventory/equipment/ammo) * @param ammo a list of ammo tpls the weapon can use * @param weaponTemplate the weapon we want to pick ammo for - * @param isPmc is the ammo being gathered for a pmc (runs pmc ammo filtering) * @returns an ammo tpl that works with the desired gun */ - protected getCompatibleAmmo(ammo: Record>, weaponTemplate: ITemplateItem, isPmc: boolean): string; + protected getWeightedCompatibleAmmo(ammo: Record>, weaponTemplate: ITemplateItem): string; /** * Get a weapons compatible cartridge caliber * @param weaponTemplate Weapon to look up caliber of diff --git a/Live/CWX_MasterKey/server/dist/types/generators/LocationGenerator.d.ts b/Live/CWX_MasterKey/server/dist/types/generators/LocationGenerator.d.ts index bd368b5..cc61dcf 100644 --- a/Live/CWX_MasterKey/server/dist/types/generators/LocationGenerator.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/generators/LocationGenerator.d.ts @@ -3,10 +3,9 @@ import { GameEventHelper } from "../helpers/GameEventHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; -import { ILooseLoot, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; +import { ILooseLoot, SpawnpointsForced, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; import { Item } from "../models/eft/common/tables/IItem"; import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticLootDetails } from "../models/eft/common/tables/ILootBase"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -36,11 +35,19 @@ export declare class LocationGenerator { generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; + /** + * Create array of loose + forced loot using probability system + * @param dynamicLootDist + * @param staticAmmoDist + * @param locationName Location to generate loot for + * @returns Array of spawn points with loot in them + */ generateDynamicLoot(dynamicLootDist: ILooseLoot, staticAmmoDist: Record, locationName: string): SpawnpointTemplate[]; + /** + * Add forced spawn point loot into loot parameter array + * @param loot array to add forced loot to + * @param forcedSpawnPoints forced loot to add + */ + protected addForcedLoot(loot: SpawnpointTemplate[], forcedSpawnPoints: SpawnpointsForced[]): void; protected createItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; - protected getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; - protected getRandomValidCaliber(magTemplate: ITemplateItem): string; - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; - protected createRandomMagCartridges(magTemplate: ITemplateItem, parentId: string, staticAmmoDist: Record, caliber?: string): Item; - protected createCartidges(parentId: string, ammoTpl: string, stackCount: number): Item; } diff --git a/Live/CWX_MasterKey/server/dist/types/generators/LootGenerator.d.ts b/Live/CWX_MasterKey/server/dist/types/generators/LootGenerator.d.ts new file mode 100644 index 0000000..bbc1915 --- /dev/null +++ b/Live/CWX_MasterKey/server/dist/types/generators/LootGenerator.d.ts @@ -0,0 +1,58 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Preset } from "../models/eft/common/IGlobals"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { LootItem } from "../models/spt/services/LootItem"; +import { LootRequest } from "../models/spt/services/LootRequest"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { HashUtil } from "../utils/HashUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class LootGenerator { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected databaseServer: DatabaseServer; + protected randomUtil: RandomUtil; + protected itemHelper: ItemHelper; + protected itemFilterService: ItemFilterService; + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, itemFilterService: ItemFilterService); + /** + * Generate a list of items based on options passed in + * @param options parameters to adjust what loot is generated + * @returns An array of loot items + */ + createRandomloot(options: LootRequest): LootItem[]; + /** + * Construct item limit record to hold max and current item count + * @param limits limits as defined in config + * @returns record, key: item tplId, value: current/max item count allowed + */ + protected initItemLimitCounter(limits: Record): Record; + /** + * Find a random item in items.json and add to result array + * @param items items to choose from + * @param itemTypeCounts item limit counts + * @param options item filters + * @param result array to add found item to + * @returns true if item was valid and added to pool + */ + protected findAndAddRandomItemToLoot(items: [string, ITemplateItem][], itemTypeCounts: Record, options: LootRequest, result: LootItem[]): boolean; + /** + * + * Find a random item in items.json and add to result array + * @param globalDefaultPresets presets to choose from + * @param itemTypeCounts item limit counts + * @param result array to add found preset to + * @returns true if preset was valid and added to pool + */ + protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, Preset][], itemTypeCounts: Record, result: LootItem[]): boolean; +} diff --git a/Live/CWX_MasterKey/server/dist/types/generators/PMCLootGenerator.d.ts b/Live/CWX_MasterKey/server/dist/types/generators/PMCLootGenerator.d.ts index 64e6f7f..b9f2a83 100644 --- a/Live/CWX_MasterKey/server/dist/types/generators/PMCLootGenerator.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/generators/PMCLootGenerator.d.ts @@ -1,15 +1,21 @@ import { ItemHelper } from "../helpers/ItemHelper"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ConfigServer } from "../servers/ConfigServer"; import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +/** + * Handle the generation of dynamic PMC loot in pockets and backpacks + * and the removal of blacklisted items + */ export declare class PMCLootGenerator { protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; + protected itemFilterService: ItemFilterService; protected pocketLootPool: string[]; protected backpackLootPool: string[]; protected botConfig: IBotConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService); generatePMCPocketLootPool(): string[]; generatePMCBackpackLootPool(): string[]; } diff --git a/Live/CWX_MasterKey/server/dist/types/generators/RagfairAssortGenerator.d.ts b/Live/CWX_MasterKey/server/dist/types/generators/RagfairAssortGenerator.d.ts index cbdd7f2..db4811d 100644 --- a/Live/CWX_MasterKey/server/dist/types/generators/RagfairAssortGenerator.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/generators/RagfairAssortGenerator.d.ts @@ -1,5 +1,8 @@ import { ItemHelper } from "../helpers/ItemHelper"; +import { Preset } from "../models/eft/common/IGlobals"; import { Item } from "../models/eft/common/tables/IItem"; +import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -8,18 +11,40 @@ export declare class RagfairAssortGenerator { protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; protected generatedAssortItems: Item[]; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer); + protected ragfairConfig: IRagfairConfig; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); /** * Get an array of unique items that can be sold on the flea * @returns array of unique items */ getAssortItems(): Item[]; + /** + * Check internal generatedAssortItems array has objects + * @returns true if array has objects + */ protected assortsAreGenerated(): boolean; /** * Generate an array of items the flea can sell * @returns array of unique items */ protected generateRagfairAssortItems(): Item[]; + /** + * Get presets from globals.json + * @returns Preset object array + */ + protected getPresets(): Preset[]; + /** + * Get default presets from globals.json + * @returns Preset object array + */ + protected getDefaultPresets(): Preset[]; + /** + * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true + * @param tplId tplid to add to item + * @param id id to add to item + * @returns hydrated Item object + */ protected createRagfairAssortItem(tplId: string, id?: string): Item; } diff --git a/Live/CWX_MasterKey/server/dist/types/generators/RagfairOfferGenerator.d.ts b/Live/CWX_MasterKey/server/dist/types/generators/RagfairOfferGenerator.d.ts index 3e7f4cc..317cd6b 100644 --- a/Live/CWX_MasterKey/server/dist/types/generators/RagfairOfferGenerator.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/generators/RagfairOfferGenerator.d.ts @@ -41,15 +41,37 @@ export declare class RagfairOfferGenerator { createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; protected getTraderId(userID: string): string; protected getRating(userID: string): number; + /** + * Is the offers user rating growing + * @param userID user to check rating of + * @returns true if its growing + */ protected getRatingGrowing(userID: string): boolean; + /** + * Get number of section until offer should expire + * @param userID Id of the offer owner + * @param time Time the offer is posted + * @returns number of seconds until offer expires + */ protected getOfferEndTime(userID: string, time: number): number; /** * Create multiple offers for items by using a unique list of items we've generated previously - * @param expiredOffers + * @param expiredOffers optional, expired offers to regenerate */ generateDynamicOffers(expiredOffers?: Item[]): void; - generateTraderOffers(traderID: string): void; + /** + * Generate trader offers on flea using the traders assort data + * @param traderID Trader to generate offers for + */ + generateFleaOffersForTrader(traderID: string): void; protected getItemCondition(userID: string, items: Item[], itemDetails: ITemplateItem): Item[]; + /** + * Add missing conditions to an item if needed + * Durabiltiy for repairable items + * HpResource for medical items + * @param item item to add conditions to + * @returns Item with conditions added + */ protected addMissingCondition(item: Item): Item; protected getOfferRequirements(items: Item[]): { count: number; @@ -57,6 +79,14 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a flea offer and store it in the Ragfair server offers array + * @param userID owner of the offer + * @param time time offer is put up + * @param items items in the offer + * @param barterScheme + * @param loyalLevel + * @param price price of offer + * @param sellInOnePiece + * @returns */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/Live/CWX_MasterKey/server/dist/types/generators/ScavCaseRewardGenerator.d.ts b/Live/CWX_MasterKey/server/dist/types/generators/ScavCaseRewardGenerator.d.ts index c7d6ab7..89cb5c8 100644 --- a/Live/CWX_MasterKey/server/dist/types/generators/ScavCaseRewardGenerator.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/generators/ScavCaseRewardGenerator.d.ts @@ -8,9 +8,13 @@ import { RewardCountAndPriceDetails, ScavCaseRewardCountsAndPrices } from "../mo import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { RagfairPriceService } from "../services/RagfairPriceService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +/** + * Handle the creation of randomised scav case rewards + */ export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; @@ -18,9 +22,10 @@ export declare class ScavCaseRewardGenerator { protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param body client request diff --git a/Live/CWX_MasterKey/server/dist/types/generators/WeatherGenerator.d.ts b/Live/CWX_MasterKey/server/dist/types/generators/WeatherGenerator.d.ts index 44cecbb..8ddbe49 100644 --- a/Live/CWX_MasterKey/server/dist/types/generators/WeatherGenerator.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/generators/WeatherGenerator.d.ts @@ -1,7 +1,7 @@ import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { ConfigServer } from "../servers/ConfigServer"; import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class WeatherGenerator { @@ -21,11 +21,16 @@ export declare class WeatherGenerator { protected getAcceleratedTime(computedDate: Date): string; /** * Get current time formatted to fit BSGs requirement - * @param computedDate + * @param computedDate date to format into bsg style * @returns */ protected getNormalTime(computedDate: Date): string; - generateWeather(data: IWeatherData): IWeatherData; + /** + * Return randomised Weather data + * @param weatherData weather input data + * @returns Randomised weather data + */ + generateWeather(weatherData: IWeatherData): IWeatherData; protected getWeightedFog(): string; protected getWeightedRain(): number; protected getRandomFloat(node: string): number; diff --git a/Live/CWX_MasterKey/server/dist/types/generators/weapongen/IInventoryMagGen.d.ts b/Live/CWX_MasterKey/server/dist/types/generators/weapongen/IInventoryMagGen.d.ts new file mode 100644 index 0000000..792f510 --- /dev/null +++ b/Live/CWX_MasterKey/server/dist/types/generators/weapongen/IInventoryMagGen.d.ts @@ -0,0 +1,6 @@ +import { InventoryMagGen } from "./InventoryMagGen"; +export interface IInventoryMagGen { + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_MasterKey/server/dist/types/generators/weapongen/InventoryMagGen.d.ts b/Live/CWX_MasterKey/server/dist/types/generators/weapongen/InventoryMagGen.d.ts new file mode 100644 index 0000000..30bf79f --- /dev/null +++ b/Live/CWX_MasterKey/server/dist/types/generators/weapongen/InventoryMagGen.d.ts @@ -0,0 +1,16 @@ +import { MinMax } from "../../models/common/MinMax"; +import { Inventory } from "../../models/eft/common/tables/IBotBase"; +import { ITemplateItem } from "../../models/eft/common/tables/ITemplateItem"; +export declare class InventoryMagGen { + private magCounts; + private magazineTemplate; + private weaponTemplate; + private ammoTemplate; + private pmcInventory; + constructor(magCounts: MinMax, magazineTemplate: ITemplateItem, weaponTemplate: ITemplateItem, ammoTemplate: ITemplateItem, pmcInventory: Inventory); + getMagCount(): MinMax; + getMagazineTemplate(): ITemplateItem; + getWeaponTemplate(): ITemplateItem; + getAmmoTemplate(): ITemplateItem; + getPmcInventory(): Inventory; +} diff --git a/Live/CWX_MasterKey/server/dist/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts b/Live/CWX_MasterKey/server/dist/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts new file mode 100644 index 0000000..b754d5f --- /dev/null +++ b/Live/CWX_MasterKey/server/dist/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts @@ -0,0 +1,12 @@ +import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; +import { RandomUtil } from "../../../utils/RandomUtil"; +import { IInventoryMagGen } from "../IInventoryMagGen"; +import { InventoryMagGen } from "../InventoryMagGen"; +export declare class BarrelInventoryMagGen implements IInventoryMagGen { + protected randomUtil: RandomUtil; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + constructor(randomUtil: RandomUtil, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_MasterKey/server/dist/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/Live/CWX_MasterKey/server/dist/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts new file mode 100644 index 0000000..4fcb1e2 --- /dev/null +++ b/Live/CWX_MasterKey/server/dist/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -0,0 +1,14 @@ +import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; +import { ItemHelper } from "../../../helpers/ItemHelper"; +import { ILogger } from "../../../models/spt/utils/ILogger"; +import { IInventoryMagGen } from "../IInventoryMagGen"; +import { InventoryMagGen } from "../InventoryMagGen"; +export declare class ExternalInventoryMagGen implements IInventoryMagGen { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + constructor(logger: ILogger, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_MasterKey/server/dist/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts b/Live/CWX_MasterKey/server/dist/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts new file mode 100644 index 0000000..4548a04 --- /dev/null +++ b/Live/CWX_MasterKey/server/dist/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts @@ -0,0 +1,10 @@ +import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; +import { IInventoryMagGen } from "../IInventoryMagGen"; +import { InventoryMagGen } from "../InventoryMagGen"; +export declare class InternalMagazineInventoryMagGen implements IInventoryMagGen { + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + constructor(botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_MasterKey/server/dist/types/helpers/AssortHelper.d.ts b/Live/CWX_MasterKey/server/dist/types/helpers/AssortHelper.d.ts index 15586b9..bfc157f 100644 --- a/Live/CWX_MasterKey/server/dist/types/helpers/AssortHelper.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/helpers/AssortHelper.d.ts @@ -17,7 +17,7 @@ export declare class AssortHelper { * @param assort assort items from a trader * @returns assort items minus locked quest assorts */ - stripLockedQuestAssort(pmcProfile: IPmcData, traderId: string, assort: ITraderAssort): ITraderAssort; + stripLockedQuestAssort(pmcProfile: IPmcData, traderId: string, assort: ITraderAssort, flea?: boolean): ITraderAssort; /** * Remove assorts from a trader that have not been unlocked yet * @param pmcProfile player profile @@ -32,5 +32,5 @@ export declare class AssortHelper { * @param itemID item id to remove from asort * @returns Modified assort */ - removeItemFromAssort(assort: ITraderAssort, itemID: string): ITraderAssort; + removeItemFromAssort(assort: ITraderAssort, itemID: string, flea?: boolean): ITraderAssort; } diff --git a/Live/CWX_MasterKey/server/dist/types/helpers/BotGeneratorHelper.d.ts b/Live/CWX_MasterKey/server/dist/types/helpers/BotGeneratorHelper.d.ts index 3cd7256..5e3e501 100644 --- a/Live/CWX_MasterKey/server/dist/types/helpers/BotGeneratorHelper.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/helpers/BotGeneratorHelper.d.ts @@ -1,19 +1,33 @@ import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper"; -import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem"; -import { Grid, ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { ItemFilterService } from "../services/ItemFilterService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotWeaponGeneratorHelper } from "./BotWeaponGeneratorHelper"; import { ContainerHelper } from "./ContainerHelper"; import { InventoryHelper } from "./InventoryHelper"; import { ItemHelper } from "./ItemHelper"; import { ProbabilityHelper } from "./ProbabilityHelper"; +import { ProfileHelper } from "./ProfileHelper"; +export declare class BotModLimits { + scope: ItemCount; + scopeMax: number; + scopeBaseTypes: string[]; + flashlightLaser: ItemCount; + flashlightLaserMax: number; + flashlgihtLaserBaseTypes: string[]; +} +export declare class ItemCount { + count: number; +} export declare class BotGeneratorHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -25,16 +39,121 @@ export declare class BotGeneratorHelper { protected itemHelper: ItemHelper; protected inventoryHelper: InventoryHelper; protected containerHelper: ContainerHelper; + protected botEquipmentFilterService: BotEquipmentFilterService; + protected itemFilterService: ItemFilterService; + protected profileHelper: ProfileHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, configServer: ConfigServer); - generateModsForItem(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, configServer: ConfigServer); /** - * Is this magazine cylinder related (revolvers and grenade launchers) - * @param magazineParentName the name of the magazines parent - * @returns true if it is cylinder related + * Check mods are compatible and add to array + * @param equipment Equipment item to add mods to + * @param modPool Mod list to choose frm + * @param parentId parentid of item to add mod to + * @param parentTemplate template objet of item to add mods to + * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @returns Item + compatible mods as an array */ - magazineIsCylinderRelated(magazineParentName: string): boolean; + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + /** + * @param sessionId session id + * @param weapon Weapon to add mods to + * @param modPool Pool of compatible mods to attach to weapon + * @param weaponParentId parentId of weapon + * @param parentWeaponTemplate Weapon which mods will be generated on + * @param modSpawnChances Mod spawn chances + * @param ammoTpl Ammo tpl to use when generating magazines/cartridges + * @param botRole Role of bot weapon is generated for + * @returns Weapon + mods array + */ + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; + /** + * + * @param modSlot + * @param isRandomisableSlot + * @param modsParent + * @param botEquipBlacklist + * @param itemModPool + * @param weapon array with only weapon tpl in it, ready for mods to be added + * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) + * @param parentTemplate + * @returns + */ + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + /** + * Find mod tpls of a provided type and add to modPool + * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) + * @param modTemplate db object for modItem we get compatible mods from + * @param modPool Pool of mods we are adding to + */ + protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; + /** + * Check if mod item is on limited list + has surpassed the limit set for it + * @param botRole role the bot has e.g. assault + * @param modTemplate mods template data + * @param modLimits limits set for weapon being generated for this bot + * @returns true if over item limit + */ + protected modHasReachedItemLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits): boolean; + /** + * Initalise mod limits to be used when generating a weapon + * @param botRole "assault", "bossTagilla" or "pmc" + * @returns BotModLimits object + */ + protected initModLimits(botRole: string): BotModLimits; + /** + * Generate a pool of mods for this bots mod type if bot has values inside `randomisedWeaponModSlots` array found in bot.json/equipment[botrole] + * @param allowedMods Mods to be added to mod pool + * @param botEquipBlacklist blacklist of items not allowed to be added to mod pool + * @param modSlot Slot to generate mods for + * @param itemModPool base mod pool to replace values of + */ + protected generateDynamicWeaponModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record): void; + /** + * Find all compatible mods for equipment item and add to modPool + * @param itemDetails item to find mods for + * @param modPool ModPool to add mods to + */ + generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods): void; + /** + * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist + * @param allowedMods base mods to filter + * @param botEquipBlacklist equipment blacklist + * @param modSlot slot mods belong to + * @returns Filtered array of mod tpls + */ + protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; + /** + * Check if the specific item type on the weapon has reached the set limit + * @param modTpl log mod tpl if over type limit + * @param currentCount current number of this item on gun + * @param maxLimit mod limit allowed + * @param botRole role of bot we're checking weapon of + * @returns true if limit reached + */ + protected weaponModLimitReached(modTpl: string, currentCount: { + count: number; + }, maxLimit: number, botRole: string): boolean; + /** + * Log errors if mod is not compatible with slot + * @param modToAdd template of mod to check + * @param itemSlot slot the item will be placed in + * @param modSlot slot the mod will fill + * @param parentTemplate tempalte of the mods parent item + * @returns true if valid + */ + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + /** + * Create a mod item with parameters as properties + * @param modId _id + * @param modTpl _tpl + * @param parentId parentId + * @param modSlot slotId + * @param modTemplate Used to add additional properites in the upd object + * @returns Item object + */ + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem): Item; /** * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance @@ -46,7 +165,7 @@ export declare class BotGeneratorHelper { protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; /** * Get a list of containers that hold ammo - * e.g. mod_magazine + * e.g. mod_magazine / patron_in_weapon_000 * @returns string array */ protected getAmmoContainers(): string[]; @@ -62,11 +181,11 @@ export declare class BotGeneratorHelper { * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" - * - * @param {object} items The items where the CylinderMagazine's camora are appended to - * @param {object} modPool modPool which should include available cartrigdes - * @param {string} parentId The CylinderMagazine's UID - * @param {object} parentTemplate The CylinderMagazine's template + * @param items The items where the CylinderMagazine's camora are appended to + * @param modPool modPool which should include available cartrigdes + * @param parentId The CylinderMagazine's UID + * @param parentTemplate The CylinderMagazine's template + * @returns */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** @@ -75,6 +194,13 @@ export declare class BotGeneratorHelper { * @returns string array of shells fro luitple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + /** + * Adds properties to an item + * e.g. Repairable / HasHinge / Foldable / MaxDurability + * @param itemTemplate + * @param botRole Used by weapons to randomise the durability values + * @returns Item Upd object with extra properties + */ generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { upd?: Upd; }; @@ -92,13 +218,15 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; - protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** - * Sort by spawn chance, highest to lowest, higher is more common - * @param unsortedModArray String array to sort - * @returns Sorted string array + * Get a random mod from an items compatible mods Filter array + * @param modTpl + * @param parentSlot + * @param modSlot + * @param items + * @returns item tpl */ - protected sortModArray(unsortedModArray: string[]): string[]; + protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** * Can an item be added to an item without issue * @param items @@ -107,18 +235,8 @@ export declare class BotGeneratorHelper { * @returns true if possible */ isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; - /** - * Adds an item with all its childern into specified equipmentSlots, wherever it fits. - * @param equipmentSlots - * @param parentId - * @param parentTpl - * @param itemWithChildren - * @param inventory - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: PmcInventory): boolean; - protected itemAllowedInContainer(slot: Grid, itemTpl: string): boolean; } +/** TODO - move into own class */ export declare class ExhaustableArray { private itemPool; private randomUtil; diff --git a/Live/CWX_MasterKey/server/dist/types/helpers/BotHelper.d.ts b/Live/CWX_MasterKey/server/dist/types/helpers/BotHelper.d.ts index 9b89481..18738e5 100644 --- a/Live/CWX_MasterKey/server/dist/types/helpers/BotHelper.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/helpers/BotHelper.d.ts @@ -13,11 +13,34 @@ export declare class BotHelper { protected configServer: ConfigServer; protected botConfig: IBotConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, configServer: ConfigServer); + /** + * Get difficulty settings for desired bot type, if not found use assault bot types + * @param type bot type to retreive difficulty of + * @param difficulty difficulty to get settings for (easy/normal etc) + * @returns Difficulty object + */ getBotDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Get a template object for the specified botRole from bots.types db + * @param role botRole to get template for + * @returns IBotType object + */ getBotTemplate(role: string): IBotType; + /** + * Get difficulty settings for a PMC + * @param type "usec" / "bear" + * @param difficulty what difficulty to retrieve + * @returns Difficulty object + */ getPmcDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Choose a random difficulty from - easy/normal/hard/impossible + * @returns random difficulty + */ + chooseRandomDifficulty(): string; /** * Randomise the chance the PMC will attack their own side + * Look up value in bot.json/chanceSameSideIsHostilePercent * @param difficultySettings pmc difficulty settings */ randomisePmcHostility(difficultySettings: Difficulty): void; @@ -31,7 +54,7 @@ export declare class BotHelper { */ addBotToFriendlyList(difficultySettings: Difficulty, typeToAdd: string): void; /** - * Add a bot to the ENEMY_BOT_TYPES array + * Add a bot to the ENEMY_BOT_TYPES array, do not add itself if its on the enemy list * @param difficultySettings bot settings to alter * @param typesToAdd bot type to add to enemy list */ @@ -42,4 +65,10 @@ export declare class BotHelper { * @param typesToAdd bot type to add to revenge list */ addBotToRevengeList(difficultySettings: Difficulty, typesToAdd: string[]): void; + /** + * Choose if a bot should become a PMC by checking if bot type is allowed to become a Pmc in botConfig.convertFromChances and doing a random int check + * @param botRole the bot role to check if should be a pmc + * @returns true if should be a pmc + */ + shouldBotBePmc(botRole: string): boolean; } diff --git a/Live/CWX_MasterKey/server/dist/types/helpers/BotWeaponGeneratorHelper.d.ts b/Live/CWX_MasterKey/server/dist/types/helpers/BotWeaponGeneratorHelper.d.ts new file mode 100644 index 0000000..7e25f56 --- /dev/null +++ b/Live/CWX_MasterKey/server/dist/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -0,0 +1,78 @@ +import { MinMax } from "../models/common/MinMax"; +import { Inventory } from "../models/eft/common/tables/IBotBase"; +import { Item } from "../models/eft/common/tables/IItem"; +import { Grid, ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { HashUtil } from "../utils/HashUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { ContainerHelper } from "./ContainerHelper"; +import { InventoryHelper } from "./InventoryHelper"; +import { ItemHelper } from "./ItemHelper"; +export declare class BotWeaponGeneratorHelper { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper); + /** + * Get a randomised number of bullets for a specific magazine + * @param magCounts min and max count of magazines + * @param magTemplate magazine to generate bullet count for + * @returns bullet count number + */ + getRandomisedBulletCount(magCounts: MinMax, magTemplate: ITemplateItem): number; + /** + * Get a randomised count of magazines + * @param magCounts min and max value returned value can be between + * @returns numberical value of magazine count + */ + getRandomisedMagazineCount(magCounts: MinMax): number; + /** + * Is this magazine cylinder related (revolvers and grenade launchers) + * @param magazineParentName the name of the magazines parent + * @returns true if it is cylinder related + */ + magazineIsCylinderRelated(magazineParentName: string): boolean; + /** + * Create a magazine using the parameters given + * @param magazineTpl Tpl of the magazine to create + * @param ammoTpl Ammo to add to magazine + * @param magTemplate template object of magazine + * @returns Item array + */ + createMagazine(magazineTpl: string, ammoTpl: string, magTemplate: ITemplateItem): Item[]; + /** + * Add a specific number of cartrdiges to a bots inventory (vest/pocket) + * @param ammoTpl Ammo tpl to add to vest/pockets + * @param cartridgeCount number of cartridges to add to vest/pockets + * @param inventory bot inventory to add cartridges to + */ + addBulletsToVestAndPockets(ammoTpl: string, cartridgeCount: number, inventory: Inventory): void; + /** + * Get a weapons default magazine template id + * @param weaponTemplate weapon to get default magazine for + * @returns tpl of magazine + */ + getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; + /** + * Adds an item with all its childern into specified equipmentSlots, wherever it fits. + * @param equipmentSlots + * @param parentId + * @param parentTpl + * @param itemWithChildren + * @param inventory + * @returns a `boolean` indicating item was added + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): boolean; + /** + * is the provided item allowed inside a container + * @param slot location item wants to be placed in + * @param itemTpl item being placed + * @returns true if allowed + */ + protected itemAllowedInContainer(slot: Grid, itemTpl: string): boolean; +} diff --git a/Live/CWX_MasterKey/server/dist/types/helpers/HideoutHelper.d.ts b/Live/CWX_MasterKey/server/dist/types/helpers/HideoutHelper.d.ts index 36e4009..7495a6a 100644 --- a/Live/CWX_MasterKey/server/dist/types/helpers/HideoutHelper.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/helpers/HideoutHelper.d.ts @@ -44,14 +44,72 @@ export declare class HideoutHelper { initProduction(recipeId: string, productionTime: number): Production; isProductionType(productive: Productive): productive is Production; applyPlayerUpgradesBonuses(pmcData: IPmcData, bonus: StageBonus): void; + /** + * TODO: + * After looking at the skills there doesnt seem to be a configuration per skill to boost + * the XP gain PER skill. I THINK you should be able to put the variable "SkillProgress" (just like health has it) + * and be able to tune the skill gain PER skill, but I havent tested it and Im not sure! + * @param pmcData + * @param bonus + */ protected applySkillXPBoost(pmcData: IPmcData, bonus: StageBonus): void; + /** + * Process a players hideout, update areas that use resources + increment production timers + * @param sessionID Session id + */ updatePlayerHideout(sessionID: string): void; + /** + * Update progress timer for water collector + * @param pmcData profile to update + * @param productionId id of water collection production to update + * @param hideoutProperties Hideout properties + */ + protected updateWaterCollectorProductionTimer(pmcData: IPmcData, productionId: string, hideoutProperties: { + btcFarmCGs?: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Update progress timer for scav case + * @param pmcData Profile to update + * @param productionId Id of scav case production to update + */ + protected updateScavCaseProductionTimer(pmcData: IPmcData, productionId: string): void; + /** + * Iterate over hideout areas that use resources (fuel/filters etc) and update associated values + * @param sessionID Session id + * @param pmcData Profile to update areas of + * @param hideoutProperties hideout properties + */ + protected updateAreasWithResources(sessionID: string, pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): HideoutArea; - protected updateWaterFilters(waterFilterArea: HideoutArea, pwProd: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; + /** + * Adjust water filter objects resourceValue or delete when they reach 0 resource + * @param waterFilterArea water filter area to update + * @param production production object + * @param isGeneratorOn is generatory enabled + * @param pmcData Player profile + * @returns Updated HideoutArea object + */ + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): HideoutArea; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; protected getBTCSlots(pmcData: IPmcData): number; protected getManagementSkillsSlots(): number; diff --git a/Live/CWX_MasterKey/server/dist/types/helpers/InRaidHelper.d.ts b/Live/CWX_MasterKey/server/dist/types/helpers/InRaidHelper.d.ts index c3cbfbb..962df38 100644 --- a/Live/CWX_MasterKey/server/dist/types/helpers/InRaidHelper.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -15,19 +16,8 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); - /** - * Reset the SPT inraid property stored in a profile to 'none' - * @param sessionID Session id - */ - protected removePlayer(sessionID: string): void; - /** - * Some maps have one-time-use keys (e.g. Labs - * Remove the relevant key from an inventory based on the post-raid request data passed in - * @param offraidData post-raid data - * @param sessionID Session id - */ - protected removeMapAccessKey(offraidData: ISaveProgressRequestData, sessionID: string): void; + protected profileFixerService: ProfileFixerService; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); /** * Check an array of items and add an upd object to money items with a stack count of 1 * Single stack money items have no upd object and thus no StackObjectsCount, causing issues @@ -52,6 +42,18 @@ export declare class InRaidHelper { * @returns Reset profile object */ updateProfileBaseStats(profileData: IPmcData, saveProgressRequest: ISaveProgressRequestData, sessionID: string): IPmcData; + /** + * Some maps have one-time-use keys (e.g. Labs + * Remove the relevant key from an inventory based on the post-raid request data passed in + * @param offraidData post-raid data + * @param sessionID Session id + */ + protected removeMapAccessKey(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Set the SPT inraid location Profile property to 'none' + * @param sessionID Session id + */ + protected setPlayerInRaidLocationStatusToNone(sessionID: string): void; /** * Adds SpawnedInSession property to items found in a raid * Removes SpawnedInSession for non-scav players if item was taken into raid with SpawnedInSession = true @@ -93,5 +95,10 @@ export declare class InRaidHelper { * @returns true if item is kept after death */ isItemKeptAfterDeath(slotId: string): boolean; + /** + * Return the equipped items from a players inventory + * @param items Players inventory to search through + * @returns an array of equipped items + */ getPlayerGear(items: Item[]): Item[]; } diff --git a/Live/CWX_MasterKey/server/dist/types/helpers/InventoryHelper.d.ts b/Live/CWX_MasterKey/server/dist/types/helpers/InventoryHelper.d.ts index dc7cbca..b8e5c9d 100644 --- a/Live/CWX_MasterKey/server/dist/types/helpers/InventoryHelper.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/helpers/InventoryHelper.d.ts @@ -43,6 +43,7 @@ export declare class InventoryHelper { constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; diff --git a/Live/CWX_MasterKey/server/dist/types/helpers/ItemHelper.d.ts b/Live/CWX_MasterKey/server/dist/types/helpers/ItemHelper.d.ts index 1701c62..0effaf2 100644 --- a/Live/CWX_MasterKey/server/dist/types/helpers/ItemHelper.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/helpers/ItemHelper.d.ts @@ -1,35 +1,30 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { InsuredItem } from "../models/eft/common/tables/IBotBase"; import { Item, Repairable } from "../models/eft/common/tables/IItem"; +import { IStaticAmmoDetails } from "../models/eft/common/tables/ILootBase"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ObjectId } from "../utils/ObjectId"; +import { RandomUtil } from "../utils/RandomUtil"; declare class ItemHelper { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected randomUtil: RandomUtil; + protected objectId: ObjectId; + protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer); /** - * Checks if a id is a valid item. Valid meaning that it's an item that be stored in stash + * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl * @returns boolean; true for items that may be in player posession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {*} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - isValidRewardItem(tpl: string): boolean; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - getRewardableItems(): [string, ITemplateItem][]; /** * Check if the tpl / template Id provided is a descendent of the baseclass * @@ -84,6 +79,11 @@ declare class ItemHelper { * @returns {array} The array of StackSlotItems */ generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; + /** + * Get cloned copy of all item data from items.json + * @returns array of ITemplateItem objects + */ + getItems(): ITemplateItem[]; /** * Gets item data from items.json * @param tpl items template id to look up @@ -196,6 +196,22 @@ declare class ItemHelper { * @returns ItemSize object (width and height) */ getItemSize(items: Item[], rootItemId: string): ItemHelper.ItemSize; + /** + * Get a random cartridge from an items Filter property + * @param item + * @returns + */ + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + createRandomMagCartridges(magTemplate: ITemplateItem, parentId: string, staticAmmoDist: Record, caliber?: string): Item; + protected getRandomValidCaliber(magTemplate: ITemplateItem): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + createCartidges(parentId: string, ammoTpl: string, stackCount: number): Item; + /** + * Get the size of a stack, return 1 if no stack object count property found + * @param item Item to get stack size of + * @returns size of stack + */ + getItemStackSize(item: Item): number; } declare namespace ItemHelper { interface ItemSize { diff --git a/Live/CWX_MasterKey/server/dist/types/helpers/ProfileHelper.d.ts b/Live/CWX_MasterKey/server/dist/types/helpers/ProfileHelper.d.ts index 6c150c8..9c6560a 100644 --- a/Live/CWX_MasterKey/server/dist/types/helpers/ProfileHelper.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/helpers/ProfileHelper.d.ts @@ -2,24 +2,41 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Stats } from "../models/eft/common/tables/IBotBase"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; +import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { ItemHelper } from "./ItemHelper"; export declare class ProfileHelper { + protected logger: ILogger; protected jsonUtil: JsonUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected profileSnapshotService: ProfileSnapshotService; protected fenceService: FenceService; - constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; getCompleteProfile(sessionID: string): IPmcData[]; + /** + * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen + * Server saves the post-raid changes prior to the xp screen getting the profile, this results in the xp screen using + * the now updated profile values as a base, meaning it shows x2 xp gained + * Instead, clone the post-raid profile (so we dont alter its values), apply the pre-raid xp values to the cloned objects and return + * Delete snapshot of pre-raid profile prior to returning profile data + * @param sessionId Session id + * @param output pmc and scav profiles array + * @param pmcProfile post-raid pmc profile + * @param scavProfile post-raid scav profile + * @returns updated profile array + */ + protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; /** * Add experience to a PMC inside the players profile diff --git a/Live/CWX_MasterKey/server/dist/types/helpers/QuestHelper.d.ts b/Live/CWX_MasterKey/server/dist/types/helpers/QuestHelper.d.ts index 0f68cd5..d66d150 100644 --- a/Live/CWX_MasterKey/server/dist/types/helpers/QuestHelper.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/helpers/QuestHelper.d.ts @@ -36,13 +36,30 @@ export declare class QuestHelper { protected configServer: ConfigServer; protected questConfig: IQuestConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); - questStatus(pmcData: IPmcData, questID: string): QuestStatus; /** - * returns true is the condition is satisfied + * Get status of a quest by quest id + * @param pmcData Profile to search + * @param questID Quest id to look up + * @returns QuestStauts enum + */ + getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus; + /** + * returns true is the level condition is satisfied + * @param playerLevel Players level + * @param condition Quest condition + * @returns true if player level is greater than or equal to quest */ - evaluateLevel(pmcProfile: IPmcData, cond: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; - rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progress: number): void; + /** + * Increase skill points of a skill on player profile + * @param sessionID Session id + * @param pmcData Player profile + * @param output output object to send back to client + * @param skillName Name of skill to increase skill points of + * @param progressAmount Amount of skill points to add to skill + */ + rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; getQuestLocale(questId: string): any; /** * Debug Routine for showing some information on the diff --git a/Live/CWX_MasterKey/server/dist/types/helpers/RagfairOfferHelper.d.ts b/Live/CWX_MasterKey/server/dist/types/helpers/RagfairOfferHelper.d.ts index 8d03bee..e9d72ca 100644 --- a/Live/CWX_MasterKey/server/dist/types/helpers/RagfairOfferHelper.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/helpers/RagfairOfferHelper.d.ts @@ -22,12 +22,14 @@ import { ProfileHelper } from "./ProfileHelper"; import { RagfairHelper } from "./RagfairHelper"; import { RagfairServerHelper } from "./RagfairServerHelper"; import { RagfairSortHelper } from "./RagfairSortHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class RagfairOfferHelper { protected logger: ILogger; protected timeUtil: TimeUtil; protected hashUtil: HashUtil; protected itemEventRouter: ItemEventRouter; protected databaseServer: DatabaseServer; + protected traderHelper: TraderHelper; protected saveServer: SaveServer; protected dialogueHelper: DialogueHelper; protected itemHelper: ItemHelper; @@ -43,10 +45,10 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; - processOffers(sessionID: string): boolean; + processOffersOnProfile(sessionID: string): boolean; protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; diff --git a/Live/CWX_MasterKey/server/dist/types/helpers/RagfairSellHelper.d.ts b/Live/CWX_MasterKey/server/dist/types/helpers/RagfairSellHelper.d.ts index 6ec004a..91b8a20 100644 --- a/Live/CWX_MasterKey/server/dist/types/helpers/RagfairSellHelper.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/helpers/RagfairSellHelper.d.ts @@ -11,6 +11,12 @@ export declare class RagfairSellHelper { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateSellChance(baseChance: number, offerPrice: number, requirementsPriceInRub: number): number; - rollForSale(sellChance: number, count: number): SellResult[]; + calculateSellChance(baseChancePercent: number, offerPriceRub: number, playerListedPriceRub: number): number; + /** + * Determine if the offer being listed will be sold + * @param sellChancePercent chance item will sell + * @param itemSellCount count of items to sell + * @returns Array of purchases of item(s) lsited + */ + rollForSale(sellChancePercent: number, itemSellCount: number): SellResult[]; } diff --git a/Live/CWX_MasterKey/server/dist/types/helpers/RagfairServerHelper.d.ts b/Live/CWX_MasterKey/server/dist/types/helpers/RagfairServerHelper.d.ts index e4939d1..a03cdda 100644 --- a/Live/CWX_MasterKey/server/dist/types/helpers/RagfairServerHelper.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/helpers/RagfairServerHelper.d.ts @@ -6,6 +6,7 @@ import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -13,6 +14,9 @@ import { RandomUtil } from "../utils/RandomUtil"; import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { ProfileHelper } from "./ProfileHelper"; +/** + * Helper class for common ragfair server actions + */ export declare class RagfairServerHelper { protected randomUtil: RandomUtil; protected hashUtil: HashUtil; @@ -23,11 +27,12 @@ export declare class RagfairServerHelper { protected localeService: LocaleService; protected dialogueHelper: DialogueHelper; protected jsonUtil: JsonUtil; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; protected static goodsReturnedTemplate: string; - constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); + constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Is item valid / on blacklist / quest item * @param itemDetails diff --git a/Live/CWX_MasterKey/server/dist/types/helpers/RepairHelper.d.ts b/Live/CWX_MasterKey/server/dist/types/helpers/RepairHelper.d.ts index 9a3ab29..5b09320 100644 --- a/Live/CWX_MasterKey/server/dist/types/helpers/RepairHelper.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/helpers/RepairHelper.d.ts @@ -14,8 +14,17 @@ export declare class RepairHelper { protected configServer: ConfigServer; protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); - updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit?: boolean, applyRandomDegradation?: boolean): Item; - protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number): number; - protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, armorMax: number): number; + /** + * + * @param itemToRepair item to update durability details + * @param itemToRepairDetails db details of item to repair + * @param isArmor Is item being repaired a piece of armor + * @param amountToRepair how many unit of durability to repair + * @param useRepairKit Is item being repaired with a repair kit + * @param applyMaxDurabilityDegradation should item have max durability reduced + */ + updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit: boolean, traderQualityMultipler: number, applyMaxDurabilityDegradation?: boolean): void; + protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number, traderQualityMultipler: number): number; + protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, weaponMax: number, traderQualityMultipler: number): number; isWeaponTemplate(tpl: string): boolean; } diff --git a/Live/CWX_MasterKey/server/dist/types/helpers/TradeHelper.d.ts b/Live/CWX_MasterKey/server/dist/types/helpers/TradeHelper.d.ts index 975062b..7ab9768 100644 --- a/Live/CWX_MasterKey/server/dist/types/helpers/TradeHelper.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/helpers/TradeHelper.d.ts @@ -39,6 +39,12 @@ export declare class TradeHelper { * @returns */ sellItem(pmcData: IPmcData, body: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Increment the assorts buy count by number of items purchased + * Show error on screen if player attepts 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; protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/Live/CWX_MasterKey/server/dist/types/helpers/TraderAssortHelper.d.ts b/Live/CWX_MasterKey/server/dist/types/helpers/TraderAssortHelper.d.ts index 91ba6b9..025efd6 100644 --- a/Live/CWX_MasterKey/server/dist/types/helpers/TraderAssortHelper.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/helpers/TraderAssortHelper.d.ts @@ -1,7 +1,7 @@ import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator"; import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; import { Item } from "../models/eft/common/tables/IItem"; -import { ITraderAssort } from "../models/eft/common/tables/ITrader"; +import { ITrader, ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -10,13 +10,16 @@ import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; +import { TimeUtil } from "../utils/TimeUtil"; import { AssortHelper } from "./AssortHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class TraderAssortHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; protected mathUtil: MathUtil; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected assortHelper: AssortHelper; @@ -24,18 +27,32 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts + * Filter out assorts not unlocked due to level OR quest completion * @param sessionId session id - * @param traderId trader id - * @returns a traders assorts + * @param traderId traders id + * @returns a traders' assorts */ - getAssort(sessionId: string, traderId: string): ITraderAssort; + getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset a traders assorts and move nextResupply value to future + * Flag trader as needing a flea offer reset to be picked up by flea update() function + * @param trader trader details to alter + */ + resetExpiredTrader(trader: ITrader): void; + /** + * Does the supplied trader need its assorts refreshed + * @param traderID Trader to check + * @returns true they need refreshing + */ + traderAssortsHaveExpired(traderID: string): boolean; /** * Iterate over all assorts barter_scheme values, find barters selling for money and multiply by multipler in config * @param traderAssort Assorts to multiple price of diff --git a/Live/CWX_MasterKey/server/dist/types/helpers/TraderHelper.d.ts b/Live/CWX_MasterKey/server/dist/types/helpers/TraderHelper.d.ts index b2e9d38..0dc93e8 100644 --- a/Live/CWX_MasterKey/server/dist/types/helpers/TraderHelper.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/helpers/TraderHelper.d.ts @@ -9,6 +9,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { PlayerService } from "../services/PlayerService"; +import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -23,9 +24,10 @@ export declare class TraderHelper { protected handbookHelper: HandbookHelper; protected playerService: PlayerService; protected fenceService: FenceService; + protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -63,7 +65,7 @@ export declare class TraderHelper { * @param item * @returns boolean */ - protected isWeaponAndBelowTraderBuyDurability(traderID: string, item: Item): boolean; + protected isWeaponBelowTraderBuyDurability(traderID: string, item: Item): boolean; /** * Get the price of an item and all of its attached children * Take into account bonuses/adjsutments e.g. discounts @@ -97,6 +99,17 @@ export declare class TraderHelper { * @param sessionID session id */ lvlUp(traderID: string, sessionID: string): void; + /** + * Get the next update timestamp for a trader + * @param traderID Trader to look up update value for + * @returns future timestamp + */ + getNextUpdateTimestamp(traderID: string): number; + /** + * Get the reset time between trader assort refreshes in seconds + * @param traderId Trader to look up + * @returns Time in seconds + */ getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader diff --git a/Live/CWX_MasterKey/server/dist/types/loaders/PreAkiModLoader.d.ts b/Live/CWX_MasterKey/server/dist/types/loaders/PreAkiModLoader.d.ts index 6ded3c6..4ab1689 100644 --- a/Live/CWX_MasterKey/server/dist/types/loaders/PreAkiModLoader.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/loaders/PreAkiModLoader.d.ts @@ -33,9 +33,20 @@ export declare class PreAkiModLoader implements IModLoader { protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; /** - * - * @param mods Get an array of broken/invalid mods by name - * @returns Mod names array + * Check for duplciate mods loaded, show error if duplicate mod found + * @param modPackageData dictionary of mod package.json data + */ + protected checkForDuplicateMods(modPackageData: Record): void; + /** + * Check for and return duplicate strings inside an array + * @param stringArray Array to check for duplicates + * @returns string array of duplicates, empty if none found + */ + protected getDuplicates(stringArray: string[]): string[]; + /** + * Get an array of mods with errors that prevent them from working with SPT + * @param mods mods to validate + * @returns Mod names as array */ protected getBrokenMods(mods: string[]): string[]; /** @@ -57,7 +68,12 @@ export declare class PreAkiModLoader implements IModLoader { protected addMod(mod: string): Promise; protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record): boolean; protected isModCompatible(mod: IPackageJsonData, loadedMods: Record): boolean; - protected validMod(mod: string): boolean; + /** + * Validate a mod passes a number of checks + * @param modName name of mod in /mods/ to validate + * @returns true if valid + */ + protected validMod(modName: string): boolean; protected getLoadOrderRecursive(mod: string, result: Record, visited: Record): void; protected getLoadOrder(mods: Record): Record; getContainer(): DependencyContainer; diff --git a/Live/CWX_MasterKey/server/dist/types/models/eft/common/IGlobals.d.ts b/Live/CWX_MasterKey/server/dist/types/models/eft/common/IGlobals.d.ts index 9d28dbc..81e2023 100644 --- a/Live/CWX_MasterKey/server/dist/types/models/eft/common/IGlobals.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/models/eft/common/IGlobals.d.ts @@ -1175,5 +1175,6 @@ export interface Preset { _name: string; _parent: string; _items: Item[]; + /** Default presets have this property */ _encyclopedia?: string; } diff --git a/Live/CWX_MasterKey/server/dist/types/models/eft/common/ILocationBase.d.ts b/Live/CWX_MasterKey/server/dist/types/models/eft/common/ILocationBase.d.ts index b1dd448..78ade9a 100644 --- a/Live/CWX_MasterKey/server/dist/types/models/eft/common/ILocationBase.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/models/eft/common/ILocationBase.d.ts @@ -137,7 +137,7 @@ export interface BotLocationModifier { VisibleDistance: number; } export interface MinMaxBot { - WildSpawnType: string; + WildSpawnType: WildSpawnType; max: number; min: number; } @@ -195,7 +195,7 @@ export interface Wave { BotPreset: string; BotSide: string; SpawnPoints: string; - WildSpawnType: string; + WildSpawnType: WildSpawnType; isPlayers: boolean; number: number; slots_max: number; @@ -203,3 +203,7 @@ export interface Wave { time_max: number; time_min: number; } +export declare enum WildSpawnType { + ASSAULT = "assault", + MARKSMAN = "marksman" +} diff --git a/Live/CWX_MasterKey/server/dist/types/models/eft/common/tables/IBotBase.d.ts b/Live/CWX_MasterKey/server/dist/types/models/eft/common/tables/IBotBase.d.ts index 0ee468e..25cb861 100644 --- a/Live/CWX_MasterKey/server/dist/types/models/eft/common/tables/IBotBase.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/models/eft/common/tables/IBotBase.d.ts @@ -28,6 +28,8 @@ export interface IBotBase { CarExtractCounts: CarExtractCounts; SurvivorClass: SurvivorClass; WishList: string[]; + /** SPT specific property used during bot generation in raid */ + sptIsPmc?: boolean; } export interface Info { EntryPoint: string; @@ -66,13 +68,13 @@ export interface IBan { dateTime: number; } export declare enum BanType { - Chat = 0, - RagFair = 1, - Voip = 2, - Trading = 3, - Online = 4, - Friends = 5, - ChangeNickname = 6 + CHAT = 0, + RAGFAIR = 1, + VOIP = 2, + TRADING = 3, + ONLINE = 4, + FRIENDS = 5, + CHANGE_NICKNAME = 6 } export interface Customization { Head: string; @@ -312,11 +314,11 @@ export interface Notes { export interface CarExtractCounts { } export declare enum SurvivorClass { - Unknown = 0, - Neutralizer = 1, - Marauder = 2, - Paramedic = 3, - Survivor = 4 + UNKNOWN = 0, + NEUTRALIZER = 1, + MARAUDER = 2, + PARAMEDIC = 3, + SURVIVOR = 4 } export interface Quest { qid: string; diff --git a/Live/CWX_MasterKey/server/dist/types/models/eft/common/tables/ITemplateItem.d.ts b/Live/CWX_MasterKey/server/dist/types/models/eft/common/tables/ITemplateItem.d.ts index 23a1a14..8569e61 100644 --- a/Live/CWX_MasterKey/server/dist/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/models/eft/common/tables/ITemplateItem.d.ts @@ -34,6 +34,7 @@ export interface Props { LootExperience?: number; ExamineExperience?: number; HideEntrails?: boolean; + InsuranceDisabled?: boolean; RepairCost?: number; RepairSpeed?: number; ExtraSizeLeft?: number; @@ -79,7 +80,7 @@ export interface Props { HasShoulderContact?: boolean; SightingRange?: number; DoubleActionAccuracyPenaltyMult?: number; - ModesCount: any; + ModesCount?: any; DurabilityBurnModificator?: number; HeatFactor?: number; CoolFactor?: number; @@ -155,7 +156,7 @@ export interface Props { RigLayoutName?: string; MaxDurability?: number; armorZone?: string[]; - armorClass: any; + armorClass?: any; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -206,6 +207,7 @@ export interface Props { IsOneoff?: boolean; MustBoltBeOpennedForExternalReload?: boolean; MustBoltBeOpennedForInternalReload?: boolean; + NoFiremodeOnBoltcatch?: boolean; BoltAction?: boolean; HipAccuracyRestorationDelay?: number; HipAccuracyRestorationSpeed?: number; @@ -252,8 +254,8 @@ export interface Props { foodUseTime?: number; foodEffectType?: string; StimulatorBuffs?: string; - effects_health: any; - effects_damage: any; + effects_health?: any; + effects_damage?: any; MaximumNumberOfUsage?: number; knifeHitDelay?: number; knifeHitSlashRate?: number; diff --git a/Live/CWX_MasterKey/server/dist/types/models/eft/common/tables/ITrader.d.ts b/Live/CWX_MasterKey/server/dist/types/models/eft/common/tables/ITrader.d.ts index f0fe2b5..37b2d61 100644 --- a/Live/CWX_MasterKey/server/dist/types/models/eft/common/tables/ITrader.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/models/eft/common/tables/ITrader.d.ts @@ -7,7 +7,7 @@ export interface ITrader { suits?: ISuit[]; } export interface ITraderBase { - refreshAssort: boolean; + refreshTraderRagfairOffers: boolean; _id: string; avatar: string; balance_dol: number; @@ -58,7 +58,7 @@ export interface Repair { quality: string; } export interface ITraderAssort { - nextResupply?: number; + nextResupply: number; items: Item[]; barter_scheme: Record; loyal_level_items: Record; @@ -67,6 +67,7 @@ export interface IBarterScheme { count: number; _tpl: string; onlyFunctional?: boolean; + sptQuestLocked?: boolean; } export interface ISuit { _id: string; diff --git a/Live/CWX_MasterKey/server/dist/types/models/eft/health/Effect.d.ts b/Live/CWX_MasterKey/server/dist/types/models/eft/health/Effect.d.ts index 2f0adac..7eb3ffc 100644 --- a/Live/CWX_MasterKey/server/dist/types/models/eft/health/Effect.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/models/eft/health/Effect.d.ts @@ -1,5 +1,5 @@ export declare enum Effect { - Fracture = "Fracture", - LightBleeding = "LightBleeding", - HeavyBleeding = "HeavyBleeding" + FRACTURE = "Fracture", + LIGHT_BLEEDING = "LightBleeding", + HEAVY_BLEEDING = "HeavyBleeding" } diff --git a/Live/CWX_MasterKey/server/dist/types/models/eft/health/IOffraidHealRequestData.d.ts b/Live/CWX_MasterKey/server/dist/types/models/eft/health/IOffraidHealRequestData.d.ts index c242300..26b02bd 100644 --- a/Live/CWX_MasterKey/server/dist/types/models/eft/health/IOffraidHealRequestData.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/models/eft/health/IOffraidHealRequestData.d.ts @@ -7,12 +7,12 @@ export interface IOffraidHealRequestData extends IBaseInteractionRequestData { time: number; } export declare enum BodyPart { - Head = 0, - Chest = 1, - Stomach = 2, - LeftArm = 3, - RightArm = 4, - LeftLeg = 5, - RightLeg = 6, - Common = 7 + HEAD = "Head", + CHEST = "Chest", + STOMACH = "Stomach", + LEFT_ARM = "LeftArm", + RIGHT_ARM = "RightArm", + LEFT_LEG = "LeftLeg", + RIGHT_LEG = "RightLeg", + COMMON = "Common" } diff --git a/Live/CWX_MasterKey/server/dist/types/models/eft/notifier/INotifier.d.ts b/Live/CWX_MasterKey/server/dist/types/models/eft/notifier/INotifier.d.ts index 8c48260..b248636 100644 --- a/Live/CWX_MasterKey/server/dist/types/models/eft/notifier/INotifier.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/models/eft/notifier/INotifier.d.ts @@ -1,9 +1,9 @@ export interface INotifierChannel { - "server": string; - "channel_id": string; - "url": string; - "notifierServer": string; - "ws": string; + server: string; + channel_id: string; + url: string; + notifierServer: string; + ws: string; } import { Message } from "../profile/IAkiProfile"; export interface INotification { diff --git a/Live/CWX_MasterKey/server/dist/types/models/eft/ragfair/IRagfairOffer.d.ts b/Live/CWX_MasterKey/server/dist/types/models/eft/ragfair/IRagfairOffer.d.ts index 63f655e..141b605 100644 --- a/Live/CWX_MasterKey/server/dist/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -15,6 +15,8 @@ export interface IRagfairOffer { name?: string; shortName?: string; loyaltyLevel: number; + buyRestrictionMax?: number; + buyRestrictionCurrent?: number; locked: boolean; unlimitedCount: boolean; summaryCost: number; diff --git a/Live/CWX_MasterKey/server/dist/types/models/enums/AmmoTypes.d.ts b/Live/CWX_MasterKey/server/dist/types/models/enums/AmmoTypes.d.ts index b52ddcf..254b410 100644 --- a/Live/CWX_MasterKey/server/dist/types/models/enums/AmmoTypes.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/models/enums/AmmoTypes.d.ts @@ -23,7 +23,7 @@ export declare enum Ammo762x54 { BT_GZH = "5e023d34e8a400319a28ed44", BS_GZH = "5e023d48186a883be655e551" } -export declare enum Ammo338Lapua { +export declare enum Ammo86x70 { TAC_X = "5fc382b6d6fa9c00c571bbc3", UCW = "5fc382c1016cce60e8341b20", AP = "5fc382a9d724d907e2077dab", @@ -85,13 +85,13 @@ export declare enum Ammo9x21 { PE_GZH = "5a26ac06c4a282000c5a90a8", BT_GZH = "5a26ac0ec4a28200741e1e18" } -export declare enum Ammo357Mag { +export declare enum Ammo9x33R { FMJ = "62330b3ed4dc74626d570b95", HOLLOW_POINT = "62330bfadc5883093563729b", SOFT_POINT = "62330c40bdd19b369e1e53d1", JACKET_HP = "62330c18744e5e31df12f516" } -export declare enum Ammo45ACP { +export declare enum Ammo1143x23ACP { MATCH_FMJ = "5e81f423763d9f754677bf2e", HYDRA_SHOK = "5efb0fc6aeb21837e749c801", LASERMATCH_FMJ = "5efb0d4f4bc50b58e81710f3", @@ -126,7 +126,7 @@ export declare enum Ammo556x45 { MK_318_MOD_0_SOST = "60194943740c5d77f6705eea", SSA_AP = "601949593ae8f707c4608daa" } -export declare enum Ammo300Blackout { +export declare enum Ammo762x35 { M62_TRACER = "619636be6db0f2477964e710", BCP_FMJ = "5fbe3ffdf8b6a877a729ea82", AP = "5fd20ff893a8961fc660a954", diff --git a/Live/CWX_MasterKey/server/dist/types/models/enums/BaseClasses.d.ts b/Live/CWX_MasterKey/server/dist/types/models/enums/BaseClasses.d.ts index e733bca..36ebc71 100644 --- a/Live/CWX_MasterKey/server/dist/types/models/enums/BaseClasses.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/models/enums/BaseClasses.d.ts @@ -25,6 +25,7 @@ export declare enum BaseClasses { SIGHTS = "5448fe7a4bdc2d6f028b456b", MEDS = "543be5664bdc2dd4348b4569", MONEY = "543be5dd4bdc2deb348b4569", + NIGHTVISION = "5a2c3a9486f774688b05e574", KEY = "543be5e94bdc2df1348b4568", KEY_MECHANICAL = "5c99f98d86f7745c314214b3", KEYCARD = "5c164d2286f774194c5e69fa", @@ -66,8 +67,8 @@ export declare enum BaseClasses { LUBRICANT = "57864e4c24597754843f8723", BATTERY = "57864ee62459775490116fc1", ASSAULT_SCOPE = "55818add4bdc2d5b648b456f", - REFLEX_SIGHT = "55818ad54bdc2ddc698b4569", TACTICAL_COMBO = "55818b164bdc2ddc698b456c", + FLASHLIGHT = "55818b084bdc2d5b648b4571", MAGAZINE = "5448bc234bdc2d3c308b4569", LIGHT_LASER = "55818b0e4bdc2dde698b456e", FLASH_HIDER = "550aa4bf4bdc2dd6348b456b", diff --git a/Live/CWX_MasterKey/server/dist/types/models/enums/BotAmount.d.ts b/Live/CWX_MasterKey/server/dist/types/models/enums/BotAmount.d.ts index d0e1df1..9ef9cab 100644 --- a/Live/CWX_MasterKey/server/dist/types/models/enums/BotAmount.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/models/enums/BotAmount.d.ts @@ -1,7 +1,7 @@ export declare enum BotAmount { - AsOnline = "AsOnline", - Low = "Low", - Medium = "Medium", - High = "High", - Horde = "Horde" + AS_ONLINE = "AsOnline", + LOW = "Low", + MEDIUM = "Medium", + HIGH = "High", + HORDE = "Horde" } diff --git a/Live/CWX_MasterKey/server/dist/types/models/enums/BotDifficulty.d.ts b/Live/CWX_MasterKey/server/dist/types/models/enums/BotDifficulty.d.ts index c901bcf..80e45ad 100644 --- a/Live/CWX_MasterKey/server/dist/types/models/enums/BotDifficulty.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/models/enums/BotDifficulty.d.ts @@ -1,8 +1,8 @@ export declare enum BotDifficulty { - AsOnline = "AsOnline", - Easy = "Easy", - Medium = "Medium", - Hard = "Hard", - Impossible = "Impossible", - Random = "Random" + AS_ONLINE = "AsOnline", + EASY = "Easy", + MEDIUM = "Medium", + HARD = "Hard", + IMPOSSIBLE = "Impossible", + RANDOM = "Random" } diff --git a/Live/CWX_MasterKey/server/dist/types/models/enums/ConfigTypes.d.ts b/Live/CWX_MasterKey/server/dist/types/models/enums/ConfigTypes.d.ts index 61d6f99..468ece5 100644 --- a/Live/CWX_MasterKey/server/dist/types/models/enums/ConfigTypes.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/models/enums/ConfigTypes.d.ts @@ -8,6 +8,7 @@ export declare enum ConfigTypes { IN_RAID = "aki-inraid", INSURANCE = "aki-insurance", INVENTORY = "aki-inventory", + ITEM = "aki-item", LOCALE = "aki-locale", LOCATION = "aki-location", MATCH = "aki-match", diff --git a/Live/CWX_MasterKey/server/dist/types/models/enums/ELocationName.d.ts b/Live/CWX_MasterKey/server/dist/types/models/enums/ELocationName.d.ts index b56cc08..7ae7caa 100644 --- a/Live/CWX_MasterKey/server/dist/types/models/enums/ELocationName.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/models/enums/ELocationName.d.ts @@ -1,5 +1,6 @@ export declare enum ELocationName { FACTORY_DAY = "factory4_day", + FACTORY_NIGHT = "factory4_night", BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", diff --git a/Live/CWX_MasterKey/server/dist/types/models/enums/MemberCategory.d.ts b/Live/CWX_MasterKey/server/dist/types/models/enums/MemberCategory.d.ts index 3bd9a21..a81380e 100644 --- a/Live/CWX_MasterKey/server/dist/types/models/enums/MemberCategory.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/models/enums/MemberCategory.d.ts @@ -1,13 +1,13 @@ export declare enum MemberCategory { - Default = 0, - Developer = 1, - UniqueId = 2, - Trader = 4, - Group = 8, - System = 16, - ChatModerator = 32, - ChatModeratorWithPermanentBan = 64, - UnitTest = 128, - Sherpa = 256, - Emissary = 512 + DEFAULT = 0, + DEVELOPER = 1, + UNIQUE_ID = 2, + TRADER = 4, + GROUP = 8, + SYSTEM = 16, + CHAT_MODERATOR = 32, + CHAT_MODERATOR_WITH_PERMANENT_BAN = 64, + UNIT_TEST = 128, + SHERPA = 256, + EMISSARY = 512 } diff --git a/Live/CWX_MasterKey/server/dist/types/models/enums/QuestRewardType.d.ts b/Live/CWX_MasterKey/server/dist/types/models/enums/QuestRewardType.d.ts index 1d3db86..16f7e39 100644 --- a/Live/CWX_MasterKey/server/dist/types/models/enums/QuestRewardType.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/models/enums/QuestRewardType.d.ts @@ -1,8 +1,8 @@ export declare enum QuestRewardType { - Skill = "Skill", - Experience = "Experience", - TraderStanding = "TraderStanding", - TraderUnlock = "TraderUnlock", - Item = "Item", - AssortmentUnlock = "AssortmentUnlock" + SKILL = "Skill", + EXPERIENCE = "Experience", + TRADER_STANDING = "TraderStanding", + TRADER_UNLOCK = "TraderUnlock", + ITEM = "Item", + ASSORTMENT_UNLOCK = "AssortmentUnlock" } diff --git a/Live/CWX_MasterKey/server/dist/types/models/enums/RaidMode.d.ts b/Live/CWX_MasterKey/server/dist/types/models/enums/RaidMode.d.ts index c5a8cff..e20cf3f 100644 --- a/Live/CWX_MasterKey/server/dist/types/models/enums/RaidMode.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/models/enums/RaidMode.d.ts @@ -1,5 +1,5 @@ export declare enum RaidMode { - Online = "Online", - Local = "Local", - Coop = "Coop" + ONLINE = "Online", + LOCAL = "Local", + COOP = "Coop" } diff --git a/Live/CWX_MasterKey/server/dist/types/models/enums/WeaponTypes.d.ts b/Live/CWX_MasterKey/server/dist/types/models/enums/WeaponTypes.d.ts new file mode 100644 index 0000000..867b052 --- /dev/null +++ b/Live/CWX_MasterKey/server/dist/types/models/enums/WeaponTypes.d.ts @@ -0,0 +1,151 @@ +export declare enum Weapons127x55 { + ASH_12 = "5cadfbf7ae92152ac412eeef" +} +export declare enum Weapons86x70 { + MK_18 = "5fc22d7c187fea44d52eda44", + AXMC = "627e14b21713922ded6f2c15" +} +export declare enum Weapons9x39 { + AS_VAL = "57c44b372459772d2b39b8ce", + VSS_VINTOREZ = "57838ad32459774a17445cd2" +} +export declare enum Weapons762x54R { + SVDS = "5c46fbd72e2216398b5a8c9c", + MP_18 = "61f7c9e189e6fb1a5e3ea78d", + MOSIN_INFANTRY = "5bfd297f0db834001a669119", + MOSIN_SNIPER = "5ae08f0a5acfc408fb1398a1", + SV_98 = "55801eed4bdc2d89578b4588" +} +export declare enum Weapons762x51 { + VPO_101 = "5c501a4d2e221602b412b540", + DT_MDR_762 = "5dcbd56fdbd3d91b3e5468d5", + SA_58 = "5b0bbe4e5acfc40dc528a72d", + SCARH_BLACK = "6183afd850224f204c1da514", + SCARH_FDE = "6165ac306ef05c2ce828ef74", + HK_G28 = "6176aca650224f204c1da3fb", + M1A = "5aafa857e5b5b00018480968", + RFB = "5f2a9575926fd9352339381f", + RSASS = "5a367e5dc4a282000e49738f", + SR_25 = "5df8ce05b11454561e39243b", + DVL_10 = "588892092459774ac91d4b11", + M700 = "5bfea6e90db834001b7347f3", + T5000M = "5df24cf80dee1b22f862e9bc" +} +export declare enum Weapons366TKM { + VPO_209 = "59e6687d86f77411d949b251", + VPO_215 = "5de652c31b7e3716273428be" +} +export declare enum Weapons762x39 { + OP_SKS = "587e02ff24597743df3deaeb", + SKS = "574d967124597745970e7c94", + AK_103 = "5ac66d2e5acfc43b321d4b53", + AK_104 = "5ac66d725acfc43b321d4b60", + AKM = "59d6088586f774275f37482f", + AKMN = "5a0ec13bfcdbcb00165aa685", + AKMS = "59ff346386f77477562ff5e2", + AKMSN = "5abcbc27d8ce8700182eceeb", + MK47_MUTANT = "606587252535c57a13424cfd", + RD_704 = "628a60ae6b1d481ff772e9c8", + VPO_136 = "59e6152586f77473dc057aa1" +} +export declare enum Weapons762x35 { + MCX = "5fbcc1d9016cce60e8341ab3" +} +export declare enum Weapons556x45 { + ADAR_2_15 = "5c07c60e0db834002330051f", + AK_101 = "5ac66cb05acfc40198510a10", + AK_102 = "5ac66d015acfc400180ae6e4", + DT_MDR_556 = "5c488a752e221602b412af63", + HK_416A5 = "5bb2475ed4351e00853264e3", + HK_G36 = "623063e994fc3f7b302a9696", + M4A1 = "5447a9cd4bdc2dbd208b4567", + SCARL_BLACK = "6184055050224f204c1da540", + SCARL_FDE = "618428466ef05c2ce828f218", + TX15_DML = "5d43021ca4b9362eab4b5e25" +} +export declare enum Weapons545x39 { + AK_105 = "5ac66d9b5acfc4001633997a", + AK_74 = "5bf3e03b0db834001d2c4a9c", + AK_74M = "5ac4cd105acfc40016339859", + AK_74N = "5644bd2b4bdc2d3b4c8b4572", + AKS_74 = "5bf3e0490db83400196199af", + AKS_74N = "5ab8e9fcd8ce870019439434", + AKS_74U = "57dc2fa62459775949412633", + AKS_74UB = "5839a40f24597726f856b511", + AKS_74UN = "583990e32459771419544dd2", + SAG_AK = "628b5638ad252a16da6dd245", + SAG_AK_SHORT = "628b9c37a733087d0d7fe84b", + RPK_16 = "5beed0f50db834001c062b12" +} +export declare enum Weapons57x28FN { + FN_57_BLACK = "5d3eb3b0a4b93615055e84d2", + FN_57_FDE = "5d67abc1a4b93614ec50137f", + FN_P90 = "5cc82d76e24e8d00134b4b83" +} +export declare enum Weapons46x30HK { + MP7A1 = "5ba26383d4351e00334c93d9", + MP7A2 = "5bd70322209c4d00d7167b8f" +} +export declare enum Weapons1143x23 { + M1911A1 = "5e81c3cbac2bb513793cdc75", + M45A1 = "5f36a0e5fbf956000b716b65", + USP45 = "6193a720f8ee7e52e42109ed", + UMP45 = "5fc3e272f8b6a877a729eac5", + VECTOR45 = "5fb64bc92b1b027b1f50bcf2" +} +export declare enum Weapons9x33R { + CR_50DS = "61a4c8884f95bc3b2c5dc96f" +} +export declare enum Weapons9x21 { + SR_1MP = "59f98b4986f7746f546d2cef" +} +export declare enum Weapons9x19 { + GLOCK_17 = "5a7ae0c351dfba0017554310", + GLOCK_18C = "5b1fa9b25acfc40018633c01", + M9A3 = "5cadc190ae921500103bb3b6", + MP_443 = "576a581d2459771e7b1bc4f1", + P226R = "56d59856d2720bd8418b456a", + PL_15 = "602a9740da11d6478d5a06dc", + CR_200DS = "624c2e8614da335f1e034d8c", + MP5 = "5926bb2186f7744b1c6c6e60", + MP5K = "5d2f0d8048f0356c925bc3b0", + MP9 = "5e00903ae9dc277128008b87", + MP9_N = "5de7bd7bfd6b4e6e2276dc25", + MPX = "58948c8e86f77409493f7266", + PP_19_01 = "59984ab886f7743e98271174", + SAIGA_9 = "59f9cabd86f7743a10721f46", + STM_9 = "60339954d62c9b14ed777c06", + VECTOR_9MM = "5fc3f2d5900b1d5091531e57" +} +export declare enum Weapons9x18 { + APB = "5abccb7dd8ce87001773e277", + APS = "5a17f98cfcdbcb0980087290", + PB_SILENCED = "56e0598dd2720bb5668b45a6", + PM = "5448bd6b4bdc2dfc2f8b4569", + PM_T = "579204f224597773d619e051", + PP9_KLIN = "57f4c844245977379d5c14d1", + PP91_KEDR = "57d14d2524597714373db789", + PP91_KEDRB = "57f3c6bd24597738e730fa2f" +} +export declare enum Weapons762x25 { + TT = "571a12c42459771f627b58a0", + TT_GOLD = "5b3b713c5acfc4330140bd8d", + PPSH_41 = "5ea03f7400685063ec28bfa8" +} +export declare enum Weapons12Gauge { + M3_SUPER90 = "6259b864ebedf17603599e88", + M590A1 = "5e870397991fd70db46995c8", + M870 = "5a7828548dc32e5a9c28b516", + MP_133 = "54491c4f4bdc2db1078b4568", + MP_153 = "56dee2bdd2720bc8328b4567", + MP_155 = "606dae0ab0e443224b421bb7", + MP_43_1C = "5580223e4bdc2d1c128b457f", + MTS_255_12 = "60db29ce99594040e04c4a27", + SAIGA_12GA = "576165642459773c7a400233" +} +export declare enum Weapons20Gauge { + TOZ_106 = "5a38e6bac4a2826c6e06d79b" +} +export declare enum Weapons23x75 { + KS_23M = "5e848cc2988a8701445df1e8" +} diff --git a/Live/CWX_MasterKey/server/dist/types/models/spt/bots/BotLootCache.d.ts b/Live/CWX_MasterKey/server/dist/types/models/spt/bots/BotLootCache.d.ts index e185315..aedf7b0 100644 --- a/Live/CWX_MasterKey/server/dist/types/models/spt/bots/BotLootCache.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/models/spt/bots/BotLootCache.d.ts @@ -11,13 +11,13 @@ export declare class BotLootCache { grenadeItems: ITemplateItem[]; } export declare enum LootCacheType { - Special = "Special", - Backpack = "Backpack", - Pocket = "Pocket", - Vest = "Vest", - Combined = "Combined", - HealingItems = "HealingItems", - DrugItems = "DrugItems", - StimItems = "StimItems", - GrenadeItems = "GrenadeItems" + SPECIAL = "Special", + BACKPACK = "Backpack", + POCKET = "Pocket", + VEST = "Vest", + COMBINED = "Combined", + HEALING_ITEMS = "HealingItems", + DRUG_ITEMS = "DrugItems", + STIM_ITEMS = "StimItems", + GRENADE_ITEMS = "GrenadeItems" } diff --git a/Live/CWX_MasterKey/server/dist/types/models/spt/config/IAirdropConfig.d.ts b/Live/CWX_MasterKey/server/dist/types/models/spt/config/IAirdropConfig.d.ts index f4aee89..3edcbdd 100644 --- a/Live/CWX_MasterKey/server/dist/types/models/spt/config/IAirdropConfig.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/models/spt/config/IAirdropConfig.d.ts @@ -1,14 +1,14 @@ +import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IAirdropConfig extends IBaseConfig { kind: "aki-airdrop"; airdropChancePercent: AirdropChancePercent; - airdropMinOpenHeight: number; - airdropMaxOpenHeight: number; planeMinFlyHeight: number; planeMaxFlyHeight: number; planeVolume: number; airdropMinStartTimeSeconds: number; airdropMaxStartTimeSeconds: number; + loot: AirdropLoot; } export interface AirdropChancePercent { bigmap: number; @@ -18,3 +18,13 @@ export interface AirdropChancePercent { interchange: number; reserve: number; } +export interface AirdropLoot { + presetCount: MinMax; + itemCount: MinMax; + itemBlacklist: string[]; + itemTypeWhitelist: string[]; + /** key: item base type: value: max count */ + itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; +} diff --git a/Live/CWX_MasterKey/server/dist/types/models/spt/config/IBotConfig.d.ts b/Live/CWX_MasterKey/server/dist/types/models/spt/config/IBotConfig.d.ts index e171087..af8ceba 100644 --- a/Live/CWX_MasterKey/server/dist/types/models/spt/config/IBotConfig.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/models/spt/config/IBotConfig.d.ts @@ -1,17 +1,31 @@ import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; +import { IBotDurability } from "./IBotDurability"; +import { IPmcConfig } from "./IPmcConfig"; export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; + /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** What bot types should be classified as bosses */ bosses: string[]; - durability: Durability; + /** Control weapon/armor durability min/max values for each bot type */ + durability: IBotDurability; + /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ lootNValue: LootNvalue; + /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; - pmc: PmcConfig; + /** PMC bot specific config settings */ + pmc: IPmcConfig; + /** Control how many items are allowed to spawn on a bot + * key: bottype, value: */ itemSpawnLimits: Record>; - equipment: Record; + /** Blacklist/whitelist items on a bot */ + equipment: Record; + /** Show a bots botType value after their name */ showTypeInNickname: boolean; - maxBotCap: number; + /** Max number of bots that can be spawned in a raid at any one time */ + maxBotCap: Record; + /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; } export interface PresetBatch { @@ -44,79 +58,23 @@ export interface PresetBatch { test: number; exUsec: number; } -export interface Durability { - default: DefaultDurability; - pmc: PmcDurability; - boss: BotDurability; - follower: BotDurability; - assault: BotDurability; - cursedassault: BotDurability; - marksman: BotDurability; - pmcbot: BotDurability; - exusec: BotDurability; - sectantpriest: BotDurability; - sectantwarrior: BotDurability; -} -export interface DefaultDurability { - armor: DefaultArmor; - weapon: WeaponDurability; -} -export interface DefaultArmor { - maxDelta: number; - minDelta: number; -} -export interface WeaponDurability { - lowestMax: number; - highestMax: number; - maxDelta: number; - minDelta: number; -} -export interface PmcDurability { - armor: PmcDurabilityArmor; - weapon: WeaponDurability; -} -export interface PmcDurabilityArmor { - lowestMaxPercent: number; - highestMaxPercent: number; - maxDelta: number; - minDelta: number; -} -export interface BotDurability { - armor: ArmorDurability; - weapon: WeaponDurability; -} -export interface ArmorDurability { - maxDelta: number; - minDelta: number; -} export interface LootNvalue { scav: number; pmc: number; } -export interface PmcConfig { - dynamicLoot: PmcDynamicLoot; - difficulty: string; - looseWeaponInBackpackChancePercent: number; - looseWeaponInBackpackLootMinMax: MinMax; - isUsec: number; - chanceSameSideIsHostilePercent: number; - usecType: string; - bearType: string; - maxBackpackLootTotalRub: number; - maxPocketLootTotalRub: number; - maxVestLootTotalRub: number; - convertIntoPmcChance: Record; - enemyTypes: string[]; -} -export interface PmcDynamicLoot { - whitelist: string[]; - blacklist: string[]; - moneyStackLimits: Record; -} -export interface Equipment { +export interface EquipmentFilters { + weaponModLimits: ModLimits; + randomisedWeaponModSlots?: string[]; + randomisedArmorSlots?: string[]; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; } +export interface ModLimits { + /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ + scopeLimit?: number; + /** How many lasers or lights are allowed on a weapon - hard coded to work with TACTICAL_COMBO, and FLASHLIGHT */ + lightLaserLimit?: number; +} export interface EquipmentFilterDetails { levelRange: MinMax; equipment: Record; diff --git a/Live/CWX_MasterKey/server/dist/types/models/spt/config/IBotDurability.d.ts b/Live/CWX_MasterKey/server/dist/types/models/spt/config/IBotDurability.d.ts new file mode 100644 index 0000000..38a47cc --- /dev/null +++ b/Live/CWX_MasterKey/server/dist/types/models/spt/config/IBotDurability.d.ts @@ -0,0 +1,47 @@ +export interface IBotDurability { + default: DefaultDurability; + pmc: PmcDurability; + boss: BotDurability; + follower: BotDurability; + assault: BotDurability; + cursedassault: BotDurability; + marksman: BotDurability; + pmcbot: BotDurability; + exusec: BotDurability; + gifter: BotDurability; + sectantpriest: BotDurability; + sectantwarrior: BotDurability; +} +/** Durability values to be used when a more specific bot type cant be found */ +export interface DefaultDurability { + armor: DefaultArmor; + weapon: WeaponDurability; +} +export interface DefaultArmor { + maxDelta: number; + minDelta: number; +} +export interface WeaponDurability { + lowestMax: number; + highestMax: number; + maxDelta: number; + minDelta: number; +} +export interface PmcDurability { + armor: PmcDurabilityArmor; + weapon: WeaponDurability; +} +export interface PmcDurabilityArmor { + lowestMaxPercent: number; + highestMaxPercent: number; + maxDelta: number; + minDelta: number; +} +export interface BotDurability { + armor: ArmorDurability; + weapon: WeaponDurability; +} +export interface ArmorDurability { + maxDelta: number; + minDelta: number; +} diff --git a/Live/CWX_MasterKey/server/dist/types/models/spt/config/IHideoutConfig.d.ts b/Live/CWX_MasterKey/server/dist/types/models/spt/config/IHideoutConfig.d.ts index 36d6246..f232052 100644 --- a/Live/CWX_MasterKey/server/dist/types/models/spt/config/IHideoutConfig.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/models/spt/config/IHideoutConfig.d.ts @@ -2,6 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; runIntervalSeconds: number; - fuelDrainRateMultipler: number; hoursForSkillCrafting: number; + generatorSpeedWithoutFuel: number; + generatorFuelFlowRate: number; + airFilterUnitFlowRate: number; + /** SEE HIDEOUTHELPER BEFORE CHANGING CONFIG */ + gpuBoostRate: number; } diff --git a/Live/CWX_MasterKey/server/dist/types/models/spt/config/IItemConfig.d.ts b/Live/CWX_MasterKey/server/dist/types/models/spt/config/IItemConfig.d.ts new file mode 100644 index 0000000..5ecccc2 --- /dev/null +++ b/Live/CWX_MasterKey/server/dist/types/models/spt/config/IItemConfig.d.ts @@ -0,0 +1,5 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface IItemConfig extends IBaseConfig { + kind: "aki-item"; + blacklist: string[]; +} diff --git a/Live/CWX_MasterKey/server/dist/types/models/spt/config/IPmcConfig.d.ts b/Live/CWX_MasterKey/server/dist/types/models/spt/config/IPmcConfig.d.ts new file mode 100644 index 0000000..9db2ba1 --- /dev/null +++ b/Live/CWX_MasterKey/server/dist/types/models/spt/config/IPmcConfig.d.ts @@ -0,0 +1,26 @@ +import { MinMax } from "../../common/MinMax"; +export interface IPmcConfig { + dynamicLoot: DynamicLoot; + useDifficultyOverride: boolean; + difficulty: string; + looseWeaponInBackpackChancePercent: number; + looseWeaponInBackpackLootMinMax: MinMax; + isUsec: number; + chanceSameSideIsHostilePercent: number; + /** key: location, value: type for usec/bear */ + pmcType: Record; + maxBackpackLootTotalRub: number; + maxPocketLootTotalRub: number; + maxVestLootTotalRub: number; + convertIntoPmcChance: Record; + enemyTypes: string[]; +} +export interface PmcTypes { + usec: string; + bear: string; +} +export interface DynamicLoot { + whitelist: string[]; + blacklist: string[]; + moneyStackLimits: Record; +} diff --git a/Live/CWX_MasterKey/server/dist/types/models/spt/config/IQuestConfig.d.ts b/Live/CWX_MasterKey/server/dist/types/models/spt/config/IQuestConfig.d.ts index be4a97b..45c9aae 100644 --- a/Live/CWX_MasterKey/server/dist/types/models/spt/config/IQuestConfig.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/models/spt/config/IQuestConfig.d.ts @@ -4,6 +4,8 @@ export interface IQuestConfig extends IBaseConfig { kind: "aki-quest"; redeemTime: number; repeatableQuests: IRepeatableQuestConfig[]; + bearOnlyQuests: string[]; + usecOnlyQuests: string[]; } export interface IRepeatableQuestConfig { name: string; @@ -15,6 +17,10 @@ export interface IRepeatableQuestConfig { locations: Record; traderWhitelist: ITraderWhitelist[]; questConfig: IQuestConfig; + /** Item base types to block when generating rewards */ + rewardBaseTypeBlacklist: string[]; + /** Item tplIds to ignore when generating rewards */ + rewardBlacklist: string[]; } export interface IRewardScaling { levels: number[]; diff --git a/Live/CWX_MasterKey/server/dist/types/models/spt/config/IRagfairConfig.d.ts b/Live/CWX_MasterKey/server/dist/types/models/spt/config/IRagfairConfig.d.ts index c24e617..c1b8763 100644 --- a/Live/CWX_MasterKey/server/dist/types/models/spt/config/IRagfairConfig.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/models/spt/config/IRagfairConfig.d.ts @@ -12,6 +12,7 @@ export interface Sell { chance: Chance; time: Time; reputation: Reputation; + simulatedSellHours: number; } export interface Chance { base: number; @@ -27,11 +28,18 @@ export interface Reputation { gain: number; loss: number; } +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Dynamic { + offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; price: MinMax; presetPrice: MinMax; + showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; condition: Condition; stackablePercent: MinMax; diff --git a/Live/CWX_MasterKey/server/dist/types/models/spt/config/ITraderConfig.d.ts b/Live/CWX_MasterKey/server/dist/types/models/spt/config/ITraderConfig.d.ts index c8e8044..6b1c1e3 100644 --- a/Live/CWX_MasterKey/server/dist/types/models/spt/config/ITraderConfig.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/models/spt/config/ITraderConfig.d.ts @@ -12,8 +12,10 @@ export interface UpdateTime { seconds: number; } export interface FenceConfig { + partialRefreshTimeSeconds: number; + partialRefreshChangePercent: number; assortSize: number; - maxPresetsCount: number; + maxPresetsPercent: number; presetPriceMult: number; blacklist: string[]; } diff --git a/Live/CWX_MasterKey/server/dist/types/models/spt/location/AirDropLootItem.d.ts b/Live/CWX_MasterKey/server/dist/types/models/spt/location/AirDropLootItem.d.ts new file mode 100644 index 0000000..da791ff --- /dev/null +++ b/Live/CWX_MasterKey/server/dist/types/models/spt/location/AirDropLootItem.d.ts @@ -0,0 +1,6 @@ +export declare class AirDropLootItem { + id: string; + tpl: string; + isPreset: boolean; + stackCount: number; +} diff --git a/Live/CWX_MasterKey/server/dist/types/models/spt/logging/LogBackgroundColor.d.ts b/Live/CWX_MasterKey/server/dist/types/models/spt/logging/LogBackgroundColor.d.ts index 87e08a9..1dd369b 100644 --- a/Live/CWX_MasterKey/server/dist/types/models/spt/logging/LogBackgroundColor.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/models/spt/logging/LogBackgroundColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogBackgroundColor { - default = "", - black = "blackBG", - red = "redBG", - green = "greenBG", - yellow = "yellowBG", - blue = "blueBG", - magenta = "magentaBG", - cyan = "cyanBG", - white = "whiteBG" + DEFAULT = "", + BLACK = "blackBG", + RED = "redBG", + GREEN = "greenBG", + YELLOW = "yellowBG", + BLUE = "blueBG", + MAGENTA = "magentaBG", + CYAN = "cyanBG", + WHITE = "whiteBG" } diff --git a/Live/CWX_MasterKey/server/dist/types/models/spt/logging/LogTextColor.d.ts b/Live/CWX_MasterKey/server/dist/types/models/spt/logging/LogTextColor.d.ts index 7147ae3..6c7abf3 100644 --- a/Live/CWX_MasterKey/server/dist/types/models/spt/logging/LogTextColor.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/models/spt/logging/LogTextColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogTextColor { - black = "black", - red = "red", - green = "green", - yellow = "yellow", - blue = "blue", - magenta = "magenta", - cyan = "cyan", - white = "white", - gray = "" + BLACK = "black", + RED = "red", + GREEN = "green", + YELLOW = "yellow", + BLUE = "blue", + MAGENTA = "magenta", + CYAN = "cyan", + WHITE = "white", + GRAY = "" } diff --git a/Live/CWX_MasterKey/server/dist/types/models/spt/server/ILocaleBase.d.ts b/Live/CWX_MasterKey/server/dist/types/models/spt/server/ILocaleBase.d.ts index 8887c06..6e20b89 100644 --- a/Live/CWX_MasterKey/server/dist/types/models/spt/server/ILocaleBase.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/models/spt/server/ILocaleBase.d.ts @@ -13,10 +13,10 @@ export interface ILocaleGlobalBase { season: Record; customization: Record; repeatableQuest: Record; - templates: ILocaleTemplateBase; - locations: ILocaleLocationsBase; - banners: ILocaleBannersBase; - trading: ILocaleTradingBase; + templates: Record; + locations: Record; + banners: Record; + trading: Record; } export interface ILocaleQuest { name: string; @@ -31,23 +31,11 @@ export interface ILocaleQuest { export interface ILocalePreset { Name: string; } -export interface ILocaleTemplateBase { - templates: Record; -} -export interface ILocaleLocationsBase { - locations: Record; -} -export interface ILocaleBannersBase { - locations: Record; -} export interface ILocaleProps { Name: string; ShortName: string; Description: string; } -export interface ILocaleTradingBase { - locations: Record; -} export interface ILocaleTradingProps { FullName: string; FirstName: string; diff --git a/Live/CWX_MasterKey/server/dist/types/models/spt/services/LootItem.d.ts b/Live/CWX_MasterKey/server/dist/types/models/spt/services/LootItem.d.ts new file mode 100644 index 0000000..acb7606 --- /dev/null +++ b/Live/CWX_MasterKey/server/dist/types/models/spt/services/LootItem.d.ts @@ -0,0 +1,6 @@ +export declare class LootItem { + id?: string; + tpl: string; + isPreset: boolean; + stackCount: number; +} diff --git a/Live/CWX_MasterKey/server/dist/types/models/spt/services/LootRequest.d.ts b/Live/CWX_MasterKey/server/dist/types/models/spt/services/LootRequest.d.ts new file mode 100644 index 0000000..1da8770 --- /dev/null +++ b/Live/CWX_MasterKey/server/dist/types/models/spt/services/LootRequest.d.ts @@ -0,0 +1,11 @@ +import { MinMax } from "../../common/MinMax"; +export declare class LootRequest { + presetCount: MinMax; + itemCount: MinMax; + itemBlacklist: string[]; + itemTypeWhitelist: string[]; + /** key: item base type: value: max count */ + itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; +} diff --git a/Live/CWX_MasterKey/server/dist/types/servers/DatabaseServer.d.ts b/Live/CWX_MasterKey/server/dist/types/servers/DatabaseServer.d.ts index aa152d0..b3d29e9 100644 --- a/Live/CWX_MasterKey/server/dist/types/servers/DatabaseServer.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/servers/DatabaseServer.d.ts @@ -2,5 +2,5 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; export declare class DatabaseServer { protected tableData: IDatabaseTables; getTables(): IDatabaseTables; - setTables(any: any): void; + setTables(tableData: IDatabaseTables): void; } diff --git a/Live/CWX_MasterKey/server/dist/types/servers/RagfairServer.d.ts b/Live/CWX_MasterKey/server/dist/types/servers/RagfairServer.d.ts index bc86cdb..c93864b 100644 --- a/Live/CWX_MasterKey/server/dist/types/servers/RagfairServer.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/servers/RagfairServer.d.ts @@ -1,4 +1,6 @@ import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { TraderAssortHelper } from "../helpers/TraderAssortHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -12,11 +14,18 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected traderHelper: TraderHelper; + protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, configServer: ConfigServer); + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); load(): void; update(): void; + /** + * Get traders who need to be periodically refreshed + * @returns string array of traders + */ + protected getUpdateableTraders(): string[]; getAllCategories(): Record; getBespokeCategories(offers: IRagfairOffer[]): Record; /** diff --git a/Live/CWX_MasterKey/server/dist/types/services/BotEquipmentFilterService.d.ts b/Live/CWX_MasterKey/server/dist/types/services/BotEquipmentFilterService.d.ts index e49645b..632f961 100644 --- a/Live/CWX_MasterKey/server/dist/types/services/BotEquipmentFilterService.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/services/BotEquipmentFilterService.d.ts @@ -1,12 +1,12 @@ import { IBotType } from "../models/eft/common/tables/IBotType"; -import { Equipment, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; protected configServer: ConfigServer; protected botConfig: IBotConfig; - protected botEquipmentFilterlists: Record; + protected botEquipmentFilterlists: Record; constructor(logger: ILogger, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig @@ -22,7 +22,7 @@ export declare class BotEquipmentFilterService { * @param playerLevel Level of the player * @returns EquipmentBlacklistDetails object */ - protected getBotEquipmentBlacklist(botRole: string, playerLevel: number): EquipmentFilterDetails; + getBotEquipmentBlacklist(botRole: string, playerLevel: number): EquipmentFilterDetails; /** * Get the whitelist for a specific bot type that's within the players level * @param botRole Bot type diff --git a/Live/CWX_MasterKey/server/dist/types/services/BotGenerationCacheService.d.ts b/Live/CWX_MasterKey/server/dist/types/services/BotGenerationCacheService.d.ts new file mode 100644 index 0000000..670c583 --- /dev/null +++ b/Live/CWX_MasterKey/server/dist/types/services/BotGenerationCacheService.d.ts @@ -0,0 +1,52 @@ +import { BotHelper } from "../helpers/BotHelper"; +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotGenerationCacheService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected botHelper: BotHelper; + protected storedBots: IBotBase[]; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); + /** + * Store array of bots in cache, shuffle results before storage + * @param botsToStore + */ + storeBots(botsToStore: IBotBase[]): void; + /** + * Find and return a bot based on its role + * Remove bot from internal array so it can't be retreived again + * @param role role to retreive (assault/bossTagilla etc) + * @returns IBotBase object + */ + getBot(role: string): IBotBase[]; + /** + * Find a bot by its index from cache + * @param indexOfBotToReturn index to find bot by + * @returns bot profile + */ + protected getBotFromCache(indexOfBotToReturn: number): IBotBase; + /** + * Remove bot profile by index from cache + * @param indexOfBotToReturn Index of bot profile to remove + */ + protected removeBotFromCache(indexOfBotToReturn: number): void; + /** + * Get index of bot profile that matches criteria + * @param role role of bot we want + * @param getPmc is requested bot a pmc + * @returns index of found bot + */ + protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; + /** + * Remove all cached bot profiles + */ + clearStoredBots(): void; + /** + * Does cache have bots + * @returns true if empty + */ + cacheIsEmpty(): boolean; +} diff --git a/Live/CWX_MasterKey/server/dist/types/services/BotLootCacheService.d.ts b/Live/CWX_MasterKey/server/dist/types/services/BotLootCacheService.d.ts index cc71eee..00ffb9c 100644 --- a/Live/CWX_MasterKey/server/dist/types/services/BotLootCacheService.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/services/BotLootCacheService.d.ts @@ -34,6 +34,17 @@ export declare class BotLootCacheService { * @param isPmc Is the bot a PMC (alteres what loot is cached) */ protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; + /** + * Sort a pool of item objects by its flea price + * @param poolToSort pool of items to sort + */ + protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; + /** + * Add unique items into combined pool + * @param combinedItemPool Pool of items to add to + * @param itemsToAdd items to add to combined pool if unique + */ + protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; /** * Ammo/grenades have this property * @param props diff --git a/Live/CWX_MasterKey/server/dist/types/services/FenceService.d.ts b/Live/CWX_MasterKey/server/dist/types/services/FenceService.d.ts index 79058c6..23fbf52 100644 --- a/Live/CWX_MasterKey/server/dist/types/services/FenceService.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/services/FenceService.d.ts @@ -11,29 +11,109 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; +import { ItemFilterService } from "./ItemFilterService"; +/** + * Handle actions surrounding Fence + * e.g. generating or refreshing assorts / get next refresh time + */ export declare class FenceService { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); + protected nextMiniRefreshTimestamp: number; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; - getFenceAssorts(): ITraderAssort; - hasExpiredCache(refreshAssort: boolean): boolean; - generateFenceAssortCache(pmcData: IPmcData): void; /** - * Get the fence level the passed in profile has + * Get assorts player can purchase + * Adjust prices based on fence level of player + * @param pmcProfile Player profile + * @returns ITraderAssort + */ + getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Get fence assorts with no price adjustments based on fence rep + * @returns ITraderAssort + */ + getRawFenceAssorts(): ITraderAssort; + /** + * Does fence need to perform a partial refresh because its passed the refresh timer defined in trader.json + * @returns true if it needs a partial refresh + */ + needsPartialRefresh(): boolean; + /** + * Replace a percentage of fence assorts with freshly generated items + */ + performPartialRefresh(): void; + /** + * Increment fence next refresh timestamp by current timestamp + partialRefreshTimeSeconds from config + */ + protected incrementPartialRefreshTime(): void; + /** + * Compare the current fence offer count to what the config wants it to be, + * If value is lower add extra count to value to generate more items to fill gap + * @param existingItemCountToReplace count of items to generate + * @returns number of items to generate + */ + protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + /** + * Choose an item (not mod) at random and remove from assorts + */ + protected removeRandomItemFromAssorts(): void; + /** + * Get an integer rounded count of items to replace based on percentrage from traderConfig value + * @param totalItemCount total item count + * @returns rounded int of items to replace + */ + protected getCountOfItemsToReplace(totalItemCount: number): number; + /** + * Get the count of items fence offers + * @returns number + */ + getOfferCount(): number; + /** + * Create a trader assort for fence + */ + generateFenceAssortCache(): void; + /** + * Create skeleton to hold assort items + * @returns ITraderAssort object + */ + protected createBaseTraderAssortItem(): ITraderAssort; + /** + * Hydrate result parameter object with generated assorts + * @param assortCount Number of assorts to generate + * @param assorts object to add assorts to + */ + protected createAssorts(assortCount: number, assorts: ITraderAssort): void; + /** + * Get the next update timestamp for fence + * @returns future timestamp + */ + getNextFenceUpdateTimestamp(): number; + /** + * Get fence refresh time in seconds + */ + protected getFenceRefreshTime(): number; + /** + * Get fence level the passed in profile has * @param pmcData Player profile - * @returns FenceLevel + * @returns FenceLevel object */ getFenceInfo(pmcData: IPmcData): FenceLevel; + /** + * Remove an assort from fence by id + * @param assortIdToRemove assort id to remove from fence assorts + */ removeFenceOffer(assortIdToRemove: string): void; - updateFenceOffers(pmcData: IPmcData): void; } diff --git a/Live/CWX_MasterKey/server/dist/types/services/InsuranceService.d.ts b/Live/CWX_MasterKey/server/dist/types/services/InsuranceService.d.ts index 171bf10..6be8a2f 100644 --- a/Live/CWX_MasterKey/server/dist/types/services/InsuranceService.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/services/InsuranceService.d.ts @@ -2,6 +2,7 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { InsuredItem } from "../models/eft/common/tables/IBotBase"; import { Item } from "../models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; @@ -44,8 +45,22 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; + /** + * Store lost gear post-raid inside profile + * @param pmcData player profile to store gear in + * @param offraidData post-raid request object + * @param preRaidGear gear player wore prior to raid + * @param sessionID Session id + */ storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string): void; storeInsuredItemsForReturn(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string): void; - protected addGearToSend(pmcData: IPmcData, insuredItem: any, actualItem: any, sessionID: string): any; + /** + * Add gear item to InsuredItems array in player profile + * @param pmcData profile to store item in + * @param insuredItem Item to store in profile + * @param actualItem item to store + * @param sessionID Session id + */ + protected addGearToSend(pmcData: IPmcData, insuredItem: InsuredItem, actualItem: Item, sessionID: string): void; getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; } diff --git a/Live/CWX_MasterKey/server/dist/types/services/ItemFilterService.d.ts b/Live/CWX_MasterKey/server/dist/types/services/ItemFilterService.d.ts new file mode 100644 index 0000000..c9c8ef3 --- /dev/null +++ b/Live/CWX_MasterKey/server/dist/types/services/ItemFilterService.d.ts @@ -0,0 +1,24 @@ +import { IItemConfig } from "../models/spt/config/IItemConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +/** Centralise the handling of blacklisting items, uses blacklist found in config/item.json */ +export declare class ItemFilterService { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected blacklist: string[]; + protected itemConfig: IItemConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Check if the provided template id is blacklisted in config/item.json + * @param tpl template id + * @returns true if blacklisted + */ + isItemBlacklisted(tpl: string): boolean; + /** + * Return every template id blacklisted in config/item.json + * @returns string array of blacklisted tempalte ids + */ + getBlacklistedItems(): string[]; +} diff --git a/Live/CWX_MasterKey/server/dist/types/services/PmcAiService.d.ts b/Live/CWX_MasterKey/server/dist/types/services/PmcAiService.d.ts new file mode 100644 index 0000000..0690f1f --- /dev/null +++ b/Live/CWX_MasterKey/server/dist/types/services/PmcAiService.d.ts @@ -0,0 +1,27 @@ +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +/** Storing/retreving pmcRoles set at the start of a raid - its done at that point as we know what location the player is heading to */ +export declare class PmcAiService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + protected usecRole: string; + protected bearRole: string; + constructor(logger: ILogger, configServer: ConfigServer); + /** + * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) + * @param pmcSide eft side (usec/bear) + * @returns pmc side as defined in config + */ + getPmcRole(pmcSide: "usec" | "bear" | string): string; + /** + * Set the roles for pmcs + * @param location map location to look up and use as pmc types + */ + setPmcRolesByLocation(location: string): void; + /** + * Clear the saved role from usec/bear PMCs + */ + clearPmcRoles(): void; +} diff --git a/Live/CWX_MasterKey/server/dist/types/services/ProfileFixerService.d.ts b/Live/CWX_MasterKey/server/dist/types/services/ProfileFixerService.d.ts index ed1dec7..9cb5a38 100644 --- a/Live/CWX_MasterKey/server/dist/types/services/ProfileFixerService.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/services/ProfileFixerService.d.ts @@ -45,6 +45,11 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to find and remove slots from */ protected removeResourcesFromSlotsInHideoutWithoutLocationIndexValue(pmcProfile: IPmcData): void; + /** + * Hideout slots need to be in a specific order, locationIndex in ascending order + * @param pmcProfile profile to edit + */ + protected reorderHideoutAreasWithResouceInputs(pmcProfile: IPmcData): void; /** * add in objects equal to the number of slots * @param areaType area to check diff --git a/Live/CWX_MasterKey/server/dist/types/services/ProfileSnapshotService.d.ts b/Live/CWX_MasterKey/server/dist/types/services/ProfileSnapshotService.d.ts new file mode 100644 index 0000000..445ffd0 --- /dev/null +++ b/Live/CWX_MasterKey/server/dist/types/services/ProfileSnapshotService.d.ts @@ -0,0 +1,30 @@ +import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { JsonUtil } from "../utils/JsonUtil"; +export declare class ProfileSnapshotService { + protected jsonUtil: JsonUtil; + protected storedProfileSnapshots: Record; + constructor(jsonUtil: JsonUtil); + /** + * Store a profile into an in-memory object + * @param sessionID session id - acts as the key + * @param profile - profile to save + */ + storeProfileSnapshot(sessionID: string, profile: IAkiProfile): void; + /** + * Retreve a stored profile + * @param sessionID key + * @returns A player profile object + */ + getProfileSnapshot(sessionID: string): IAkiProfile; + /** + * Does a profile exists against the provided key + * @param sessionID key + * @returns true if exists + */ + hasProfileSnapshot(sessionID: string): boolean; + /** + * Remove a stored profile by key + * @param sessionID key + */ + clearProfileSnapshot(sessionID: string): void; +} diff --git a/Live/CWX_MasterKey/server/dist/types/services/RagfairOfferService.d.ts b/Live/CWX_MasterKey/server/dist/types/services/RagfairOfferService.d.ts index 7398a8f..f9e3a34 100644 --- a/Live/CWX_MasterKey/server/dist/types/services/RagfairOfferService.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/services/RagfairOfferService.d.ts @@ -24,7 +24,6 @@ export declare class RagfairOfferService { protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected toUpdate: Record; protected expiredOffers: Item[]; protected offers: IRagfairOffer[]; protected ragfairConfig: IRagfairConfig; @@ -38,8 +37,6 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; - setTraderUpdateStatus(traderId: string, shouldUpdate: boolean): void; - shouldTraderBeUpdated(traderID: string): boolean; getExpiredOfferCount(): number; /** * Get an array of expired items not yet processed into new offers @@ -53,12 +50,15 @@ export declare class RagfairOfferService { * @returns offer exists - true */ doesOfferExist(offerId: string): boolean; - getTraders(): Record; - flagTraderForUpdate(expiredOfferUserId: string): void; removeOfferById(offerId: string): void; removeOfferStack(offerID: string, amount: number): void; removeAllOffersByTrader(traderId: string): void; - addTradersToUpdateList(): void; + /** + * Do the trader offers on flea need to be refreshed + * @param traderID Trader to check + * @returns true if they do + */ + traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; /** diff --git a/Live/CWX_MasterKey/server/dist/types/services/RagfairPriceService.d.ts b/Live/CWX_MasterKey/server/dist/types/services/RagfairPriceService.d.ts index 679fe1d..466c9e3 100644 --- a/Live/CWX_MasterKey/server/dist/types/services/RagfairPriceService.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/services/RagfairPriceService.d.ts @@ -27,6 +27,20 @@ export declare class RagfairPriceService { getDynamicPrice(itemTpl: string): number; getAllFleaPrices(): Record; getFleaPriceForItem(tplId: string): number; + /** + * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * @param itemPrice price of item + * @param itemTpl item template Id being checked + * @returns adjusted price value in roubles + */ + protected adjustPriceIfBelowHandbook(itemPrice: number, itemTpl: string): number; + /** + * Get the percentage difference between two values + * @param a numerical value a + * @param b numerical value b + * @returns different in percent + */ + protected getPriceDifference(a: number, b: number): number; getStaticPriceForItem(tplId: string): number; getBarterPrice(barterScheme: IBarterScheme[]): number; getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; diff --git a/Live/CWX_MasterKey/server/dist/types/services/RepairService.d.ts b/Live/CWX_MasterKey/server/dist/types/services/RepairService.d.ts new file mode 100644 index 0000000..3e6077c --- /dev/null +++ b/Live/CWX_MasterKey/server/dist/types/services/RepairService.d.ts @@ -0,0 +1,75 @@ +import { QuestHelper } from "../helpers/QuestHelper"; +import { RepairHelper } from "../helpers/RepairHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { RepairKitsInfo } from "../models/eft/repair/IRepairActionDataRequest"; +import { RepairItem } from "../models/eft/repair/ITraderRepairActionDataRequest"; +import { IRepairConfig } from "../models/spt/config/IRepairConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ItemEventRouter } from "../routers/ItemEventRouter"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { PaymentService } from "./PaymentService"; +export declare class RepairService { + protected logger: ILogger; + protected itemEventRouter: ItemEventRouter; + protected databaseServer: DatabaseServer; + protected questHelper: QuestHelper; + protected traderHelper: TraderHelper; + protected paymentService: PaymentService; + protected repairHelper: RepairHelper; + protected configServer: ConfigServer; + repairConfig: IRepairConfig; + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + /** + * Use trader to repair an items durability + * @param sessionID Session id + * @param pmcData profile to find item to repair in + * @param repairItemDetails details of the item to repair + * @param traderId Trader being used to repair item + * @returns RepairDetails object + */ + repairItemByTrader(sessionID: string, pmcData: IPmcData, repairItemDetails: RepairItem, traderId: string): RepairDetails; + /** + * + * @param sessionID Session id + * @param pmcData profile to take money from + * @param repairedItemId Repaired item id + * @param repairCost Cost to repair item in roubles + * @param traderId Id of the trader who repaired the item / who is paid + * @param output + */ + payForRepair(sessionID: string, pmcData: IPmcData, repairedItemId: string, repairCost: number, traderId: string, output: IItemEventRouterResponse): void; + /** + * Add skill points to profile after repairing an item + * @param sessionId Session id + * @param repairDetails details of item repaired, cost/item + * @param pmcData Profile to add points to + * @param output IItemEventRouterResponse + */ + addRepairSkillPoints(sessionId: string, repairDetails: RepairDetails, pmcData: IPmcData, output: IItemEventRouterResponse): void; + /** + * + * @param sessionId Session id + * @param pmcData Profile to update repaired item in + * @param repairKits Array of Repair kits to use + * @param itemToRepairId Item id to repair + * @param output IItemEventRouterResponse + * @returns Details of repair, item/price + */ + repairItemByKit(sessionId: string, pmcData: IPmcData, repairKits: RepairKitsInfo[], itemToRepairId: string, output: IItemEventRouterResponse): RepairDetails; + /** + * Update repair kits Resource object if it doesn't exist + * @param repairKitDetails Repair kit details from db + * @param repairKitInInventory Repair kit to update + */ + protected addMaxResourceToKitIfMissing(repairKitDetails: ITemplateItem, repairKitInInventory: Item): void; +} +export declare class RepairDetails { + repairCost?: number; + repairedItem: Item; + repairedItemIsArmor: boolean; +} diff --git a/Live/CWX_MasterKey/server/dist/types/services/TraderAssortService.d.ts b/Live/CWX_MasterKey/server/dist/types/services/TraderAssortService.d.ts index 5ba2d05..03b4e12 100644 --- a/Live/CWX_MasterKey/server/dist/types/services/TraderAssortService.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/services/TraderAssortService.d.ts @@ -2,5 +2,10 @@ import { ITraderAssort } from "../models/eft/common/tables/ITrader"; export declare class TraderAssortService { protected pristineTraderAssorts: Record; getPristineTraderAssort(traderId: string): ITraderAssort; + /** + * Store trader assorts inside a class property + * @param traderId Traderid to store assorts against + * @param assort Assorts to store + */ setPristineTraderAssort(traderId: string, assort: ITraderAssort): void; } diff --git a/Live/CWX_MasterKey/server/dist/types/utils/HashUtil.d.ts b/Live/CWX_MasterKey/server/dist/types/utils/HashUtil.d.ts index bacbf2a..a8500e1 100644 --- a/Live/CWX_MasterKey/server/dist/types/utils/HashUtil.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/utils/HashUtil.d.ts @@ -4,8 +4,18 @@ import { TimeUtil } from "./TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; constructor(timeUtil: TimeUtil); + /** + * Create a 24 character id using the sha256 algorithm + current timestamp + * @returns 24 character hash + */ generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + /** + * Create a hash for the data parameter + * @param algorithm algorithm to use to hash + * @param data data to be hashed + * @returns hash value + */ generateHashForData(algorithm: string, data: crypto.BinaryLike): string; } diff --git a/Live/CWX_MasterKey/server/dist/types/utils/RandomUtil.d.ts b/Live/CWX_MasterKey/server/dist/types/utils/RandomUtil.d.ts index c24dd60..633e472 100644 --- a/Live/CWX_MasterKey/server/dist/types/utils/RandomUtil.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/utils/RandomUtil.d.ts @@ -136,7 +136,7 @@ export declare class RandomUtil { * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with ot without replacement from the input array + * @param {boolean} replacement Draw with or without replacement from the input array * @return {array} Array consisting of N random elements */ drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; @@ -150,4 +150,10 @@ export declare class RandomUtil { */ drawRandomFromDict(dict: any, count?: number, replacement?: boolean): any[]; getBiasedRandomNumber(min: number, max: number, shift: number, n: number): number; + /** + * Fisher-Yates shuffle an array + * @param array Array to shuffle + * @returns Shuffled array + */ + shuffle(array: Array): Array; } diff --git a/Live/CWX_MasterKey/server/dist/types/utils/TimeUtil.d.ts b/Live/CWX_MasterKey/server/dist/types/utils/TimeUtil.d.ts index eed4e6d..1367e26 100644 --- a/Live/CWX_MasterKey/server/dist/types/utils/TimeUtil.d.ts +++ b/Live/CWX_MasterKey/server/dist/types/utils/TimeUtil.d.ts @@ -1,9 +1,16 @@ +/** + * Utility class to handle time related problems + */ export declare class TimeUtil { static readonly oneHourAsSeconds = 3600; formatTime(date: Date): string; formatDate(date: Date): string; getDate(): string; getTime(): string; + /** + * Get timestamp in seconds + * @returns + */ getTimestamp(): number; /** * mail in eft requires time be in a specific format @@ -15,4 +22,10 @@ export declare class TimeUtil { * @returns current date in format: 00.00.0000 (dd.mm.yyyy) */ getDateMailFormat(): string; + /** + * Convert hours into seconds + * @param hours hours to convert to seconds + * @returns number + */ + getHoursAsSeconds(hours: number): number; } diff --git a/Live/CWX_MasterKey/server/package.json b/Live/CWX_MasterKey/server/package.json index af9e2c7..5ec29d5 100644 --- a/Live/CWX_MasterKey/server/package.json +++ b/Live/CWX_MasterKey/server/package.json @@ -1,10 +1,10 @@ { "name": "MasterKey", "author": "CWX", - "version": "1.3.4", + "version": "1.3.5", "license": "NCSA", "main": "src/mod.js", - "akiVersion": "3.2.2", + "akiVersion": "3.2.3", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" ./**/*.* ./dist", diff --git a/Live/CWX_MasterKey/server/types/callbacks/InsuranceCallbacks.d.ts b/Live/CWX_MasterKey/server/types/callbacks/InsuranceCallbacks.d.ts index 6819960..8835ba2 100644 --- a/Live/CWX_MasterKey/server/types/callbacks/InsuranceCallbacks.d.ts +++ b/Live/CWX_MasterKey/server/types/callbacks/InsuranceCallbacks.d.ts @@ -1,5 +1,5 @@ import { InsuranceController } from "../controllers/InsuranceController"; -import { OnLoadOnUpdate } from "../di/OnLoadOnUpdate"; +import { OnUpdate } from "../di/OnUpdate"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData"; @@ -10,14 +10,13 @@ import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { InsuranceService } from "../services/InsuranceService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -export declare class InsuranceCallbacks extends OnLoadOnUpdate { +export declare class InsuranceCallbacks extends OnUpdate { protected insuranceController: InsuranceController; protected insuranceService: InsuranceService; protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); - onLoad(): void; getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; diff --git a/Live/CWX_MasterKey/server/types/callbacks/LocationCallbacks.d.ts b/Live/CWX_MasterKey/server/types/callbacks/LocationCallbacks.d.ts index cc69369..6e0b538 100644 --- a/Live/CWX_MasterKey/server/types/callbacks/LocationCallbacks.d.ts +++ b/Live/CWX_MasterKey/server/types/callbacks/LocationCallbacks.d.ts @@ -11,4 +11,5 @@ export declare class LocationCallbacks { constructor(httpResponse: HttpResponseUtil, locationController: LocationController); getLocationData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocation(url: string, info: IGetLocationRequestData, sessionID: string): IGetBodyResponseData; + getAirdropLoot(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/Live/CWX_MasterKey/server/types/callbacks/ProfileCallbacks.d.ts b/Live/CWX_MasterKey/server/types/callbacks/ProfileCallbacks.d.ts index 6a86fc0..183bb0a 100644 --- a/Live/CWX_MasterKey/server/types/callbacks/ProfileCallbacks.d.ts +++ b/Live/CWX_MasterKey/server/types/callbacks/ProfileCallbacks.d.ts @@ -1,5 +1,6 @@ import { ProfileController } from "../controllers/ProfileController"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IGetMiniProfileRequestData } from "../models/eft/launcher/IGetMiniProfileRequestData"; @@ -12,20 +13,51 @@ import { ISearchFriendResponse } from "../models/eft/profile/ISearchFriendRespon import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** Handle profile related client events */ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); createProfile(url: string, info: IProfileCreateRequestData, sessionID: string): IGetBodyResponseData; - getProfileData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - regenerateScav(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Get the complete player profile (scav + pmc character) + * @param url + * @param info Empty + * @param sessionID Session id + * @returns Profile object + */ + getProfileData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle the creation of a scav profile for player + * Occurs post-raid and when profile first created immediately after character details are confirmed by player + * @param url + * @param info empty + * @param sessionID Session id + * @returns Profile object + */ + regenerateScav(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/profile/voice/change event + * @param url + * @param info Change voice request object + * @param sessionID Session id + * @returns Client response + */ changeVoice(url: string, info: IProfileChangeVoiceRequestData, sessionID: string): INullResponseData; + /** + * Handle client/game/profile/nickname/change event + * Client allows player to adjust their profile name + * @param url + * @param info Change nickname request object + * @param sessionID Session id + * @returns client response + */ changeNickname(url: string, info: IProfileChangeNicknameRequestData, sessionID: string): IGetBodyResponseData; validateNickname(url: string, info: IValidateNicknameRequestData, sessionID: string): IGetBodyResponseData; getReservedNickname(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** - * Called when creating a character, when you choose a character face/voice + * Called when creating a character when choosing a character face/voice * @param url * @param info response (empty) * @param sessionID diff --git a/Live/CWX_MasterKey/server/types/callbacks/RagfairCallbacks.d.ts b/Live/CWX_MasterKey/server/types/callbacks/RagfairCallbacks.d.ts index 3a405c9..c609f2f 100644 --- a/Live/CWX_MasterKey/server/types/callbacks/RagfairCallbacks.d.ts +++ b/Live/CWX_MasterKey/server/types/callbacks/RagfairCallbacks.d.ts @@ -19,6 +19,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; +/** + * Handle ragfair related callback events + */ export declare class RagfairCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; protected logger: ILogger; diff --git a/Live/CWX_MasterKey/server/types/callbacks/RepairCallbacks.d.ts b/Live/CWX_MasterKey/server/types/callbacks/RepairCallbacks.d.ts index 63733fa..14edeeb 100644 --- a/Live/CWX_MasterKey/server/types/callbacks/RepairCallbacks.d.ts +++ b/Live/CWX_MasterKey/server/types/callbacks/RepairCallbacks.d.ts @@ -6,6 +6,20 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa export declare class RepairCallbacks { protected repairController: RepairController; constructor(repairController: RepairController); + /** + * use trader to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + /** + * Use repair kit to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ repair(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/Live/CWX_MasterKey/server/types/callbacks/TraderCallbacks.d.ts b/Live/CWX_MasterKey/server/types/callbacks/TraderCallbacks.d.ts index 128d9b2..e4fd099 100644 --- a/Live/CWX_MasterKey/server/types/callbacks/TraderCallbacks.d.ts +++ b/Live/CWX_MasterKey/server/types/callbacks/TraderCallbacks.d.ts @@ -9,10 +9,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); onLoad(): void; + onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - onUpdate(): boolean; } diff --git a/Live/CWX_MasterKey/server/types/context/ContextVariable.d.ts b/Live/CWX_MasterKey/server/types/context/ContextVariable.d.ts index e438947..0fe0a63 100644 --- a/Live/CWX_MasterKey/server/types/context/ContextVariable.d.ts +++ b/Live/CWX_MasterKey/server/types/context/ContextVariable.d.ts @@ -4,7 +4,7 @@ export declare class ContextVariable { private timestamp; private type; constructor(value: any, type: ContextVariableType); - getValue(): any; + getValue(): T; getTimestamp(): Date; getType(): ContextVariableType; } diff --git a/Live/CWX_MasterKey/server/types/controllers/BotController.d.ts b/Live/CWX_MasterKey/server/types/controllers/BotController.d.ts index 5e6f05d..a5111d5 100644 --- a/Live/CWX_MasterKey/server/types/controllers/BotController.d.ts +++ b/Live/CWX_MasterKey/server/types/controllers/BotController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotHelper } from "../helpers/BotHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; @@ -5,15 +6,22 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { IBotCore } from "../models/eft/common/tables/IBotCore"; import { Difficulty } from "../models/eft/common/tables/IBotType"; import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; +import { PmcAiService } from "../services/PmcAiService"; export declare class BotController { + protected logger: ILogger; protected databaseServer: DatabaseServer; protected botGenerator: BotGenerator; protected botHelper: BotHelper; + protected pmcAiService: PmcAiService; + protected botGenerationCacheService: BotGenerationCacheService; protected configServer: ConfigServer; + protected applicationContext: ApplicationContext; protected botConfig: IBotConfig; - constructor(databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -29,7 +37,18 @@ export declare class BotController { * @returns Difficulty object */ getBotDifficulty(type: string, difficulty: string): Difficulty; - protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string): Difficulty; + protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Generate bot profiles and store in cache + * @param sessionId Session id + * @param info bot generation request info + * @returns IBotBase array + */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the max number of bots allowed on a map + * Looks up location player is entering when getting cap value + * @returns cap number + */ getBotCap(): number; } diff --git a/Live/CWX_MasterKey/server/types/controllers/GameController.d.ts b/Live/CWX_MasterKey/server/types/controllers/GameController.d.ts index 85ec418..2d00898 100644 --- a/Live/CWX_MasterKey/server/types/controllers/GameController.d.ts +++ b/Live/CWX_MasterKey/server/types/controllers/GameController.d.ts @@ -7,11 +7,13 @@ import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; protected localeService: LocaleService; @@ -20,9 +22,14 @@ export declare class GameController { protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + /** + * Make non-trigger-spawned raiders spawn earlier + always + */ + protected adjustLabsRaiderSpawnRate(): void; protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; + getValidGameVersion(): any; } diff --git a/Live/CWX_MasterKey/server/types/controllers/HideoutController.d.ts b/Live/CWX_MasterKey/server/types/controllers/HideoutController.d.ts index 3eefe1a..dcd8894 100644 --- a/Live/CWX_MasterKey/server/types/controllers/HideoutController.d.ts +++ b/Live/CWX_MasterKey/server/types/controllers/HideoutController.d.ts @@ -28,6 +28,7 @@ import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,9 +46,10 @@ export declare class HideoutController { protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/Live/CWX_MasterKey/server/types/controllers/InraidController.d.ts b/Live/CWX_MasterKey/server/types/controllers/InraidController.d.ts index b899e7d..102a2fb 100644 --- a/Live/CWX_MasterKey/server/types/controllers/InraidController.d.ts +++ b/Live/CWX_MasterKey/server/types/controllers/InraidController.d.ts @@ -5,9 +5,11 @@ import { ItemHelper } from "../helpers/ItemHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; @@ -15,6 +17,7 @@ import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class InraidController { + protected logger: ILogger; protected saveServer: SaveServer; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; @@ -29,16 +32,40 @@ export declare class InraidController { protected inRaidHelper: InRaidHelper; protected configServer: ConfigServer; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Handle updating the profile post-pmc raid + * @param sessionID session id + * @param offraidData post-raid data of raid + */ + protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Reduce body part hp to % of max + * @param pmcData profile to edit + * @param multipler multipler to apply to max health + */ + protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + /** + * Handle updating the profile post-pscav raid + * @param sessionID session id + * @param offraidData post-raid data of raid + */ + protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Is the player dead after a raid - dead is anything other than "survived" / "runner" + * @param statusOnExit exit value from offraidData object + * @returns true if dead + */ + protected isPlayerDead(statusOnExit: string): boolean; /** * Mark inventory items as FiR if player survived raid, otherwise remove FiR from them * @param offraidData Save Progress Request * @param pmcData player profile * @param isPlayerScav Was the player a pScav */ - private markOrRemoveFoundInRaidItems; - private handlePostRaidPlayerScavProcess; - private handlePostRaidPlayerScavKarmaChanges; + protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; } diff --git a/Live/CWX_MasterKey/server/types/controllers/InventoryController.d.ts b/Live/CWX_MasterKey/server/types/controllers/InventoryController.d.ts index f57f731..f564919 100644 --- a/Live/CWX_MasterKey/server/types/controllers/InventoryController.d.ts +++ b/Live/CWX_MasterKey/server/types/controllers/InventoryController.d.ts @@ -92,7 +92,11 @@ export declare class InventoryController { */ toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; /** - * Handles Tagging of items (primary Containers). + * Add a tag to an inventory item + * @param pmcData profile with item to add tag to + * @param body tag request data + * @param sessionID session id + * @returns client response object */ tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/Live/CWX_MasterKey/server/types/controllers/LocationController.d.ts b/Live/CWX_MasterKey/server/types/controllers/LocationController.d.ts index 90b6d7a..9db3205 100644 --- a/Live/CWX_MasterKey/server/types/controllers/LocationController.d.ts +++ b/Live/CWX_MasterKey/server/types/controllers/LocationController.d.ts @@ -1,18 +1,33 @@ import { LocationGenerator } from "../generators/LocationGenerator"; +import { LootGenerator } from "../generators/LootGenerator"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; +import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; +import { LootItem } from "../models/spt/services/LootItem"; import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class LocationController { protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected logger: ILogger; protected locationGenerator: LocationGenerator; + protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; - constructor(jsonUtil: JsonUtil, logger: ILogger, locationGenerator: LocationGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil); + protected configServer: ConfigServer; + protected airdropConfig: IAirdropConfig; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; generateAll(): ILocationsGenerateAllResponse; + /** + * Get loot for an airdop container + * Generates it randomly based on config/airdrop.json values + * @returns Array of LootItem + */ + getAirdropLoot(): LootItem[]; } diff --git a/Live/CWX_MasterKey/server/types/controllers/MatchController.d.ts b/Live/CWX_MasterKey/server/types/controllers/MatchController.d.ts index 71cb7d3..07f6a89 100644 --- a/Live/CWX_MasterKey/server/types/controllers/MatchController.d.ts +++ b/Live/CWX_MasterKey/server/types/controllers/MatchController.d.ts @@ -9,23 +9,33 @@ import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestDa import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; +import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { PmcAiService } from "../services/PmcAiService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { + protected logger: ILogger; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected matchLocationService: MatchLocationService; protected traderHelper: TraderHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; + protected profileSnapshotService: ProfileSnapshotService; + protected pmcAiService: PmcAiService; + protected botGenerationCacheService: BotGenerationCacheService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + protected botConfig: IBotConfig; + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/Live/CWX_MasterKey/server/types/controllers/QuestController.d.ts b/Live/CWX_MasterKey/server/types/controllers/QuestController.d.ts index 2cbccfb..282f50e 100644 --- a/Live/CWX_MasterKey/server/types/controllers/QuestController.d.ts +++ b/Live/CWX_MasterKey/server/types/controllers/QuestController.d.ts @@ -39,16 +39,31 @@ export declare class QuestController { * @returns array of IQuest */ getClientQuests(sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param side player side (usec/bear) + * @param questId questId to check + */ + protected questIsForOtherSide(side: string, questId: string): boolean; + /** + * Handle the client accepting a quest and starting it + * Send starting rewards if any to player and + * Send start notification if any to player + * @param pmcData Profile to update + * @param acceptedQuest Quest accepted + * @param sessionID Session id + * @returns client response + */ acceptQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; acceptRepeatableQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; /** - * Remove completed quest from profile + * Update completed quest in profile * Add newly unlocked quests to profile * Also recalculate thier level due to exp rewards * @param pmcData Player profile - * @param body completed quest request - * @param sessionID session id - * @returns ItemEvent response + * @param body Completed quest request + * @param sessionID Session id + * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -67,10 +82,20 @@ export declare class QuestController { protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the quests provided + * Update quest in profile, otherwise add fresh quest object with failed status * @param sessionID session id * @param pmcData player profile * @param questsToFail quests to fail */ protected failQuests(sessionID: string, pmcData: IPmcData, questsToFail: IQuest[]): void; handoverQuest(pmcData: IPmcData, body: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Increment a backend counter stored value by an amount, + * Create counter if it does not exist + * @param pmcData Profile to find backend counter in + * @param conditionId backend counter id to update + * @param questId quest id counter is associated with + * @param counterValue value to increment the backend counter with + */ + protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; } diff --git a/Live/CWX_MasterKey/server/types/controllers/RagfairController.d.ts b/Live/CWX_MasterKey/server/types/controllers/RagfairController.d.ts index c4ffc15..06af740 100644 --- a/Live/CWX_MasterKey/server/types/controllers/RagfairController.d.ts +++ b/Live/CWX_MasterKey/server/types/controllers/RagfairController.d.ts @@ -9,6 +9,7 @@ import { RagfairOfferHelper } from "../helpers/RagfairOfferHelper"; import { RagfairSellHelper } from "../helpers/RagfairSellHelper"; import { RagfairSortHelper } from "../helpers/RagfairSortHelper"; import { RagfairTaxHelper } from "../helpers/RagfairTaxHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; @@ -33,6 +34,9 @@ import { RagfairPriceService } from "../services/RagfairPriceService"; import { RagfairRequiredItemsService } from "../services/RagfairRequiredItemsService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** + * Handle RagfairCallback events + */ export declare class RagfairController { protected logger: ILogger; protected timeUtil: TimeUtil; @@ -52,14 +56,20 @@ export declare class RagfairController { protected handbookHelper: HandbookHelper; protected paymentHelper: PaymentHelper; protected inventoryHelper: InventoryHelper; + protected traderHelper: TraderHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected ragfairOfferGenerator: RagfairOfferGenerator; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + /** + * Update a trader flea offer with buy restrictions stored in the traders assort + * @param offer flea offer to update + */ + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer): void; protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; diff --git a/Live/CWX_MasterKey/server/types/controllers/RepairController.d.ts b/Live/CWX_MasterKey/server/types/controllers/RepairController.d.ts index 0e78ef6..ae54a53 100644 --- a/Live/CWX_MasterKey/server/types/controllers/RepairController.d.ts +++ b/Live/CWX_MasterKey/server/types/controllers/RepairController.d.ts @@ -8,9 +8,9 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa import { IRepairConfig } from "../models/spt/config/IRepairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; -import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { PaymentService } from "../services/PaymentService"; +import { RepairService } from "../services/RepairService"; export declare class RepairController { protected logger: ILogger; protected itemEventRouter: ItemEventRouter; @@ -19,23 +19,23 @@ export declare class RepairController { protected traderHelper: TraderHelper; protected paymentService: PaymentService; protected repairHelper: RepairHelper; - protected configServer: ConfigServer; + protected repairService: RepairService; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); /** * Repair with trader - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + traderRepair(sessionID: string, body: ITraderRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; /** * Repair with repair kit - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - repairWithKit(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + repairWithKit(sessionID: string, body: IRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; } diff --git a/Live/CWX_MasterKey/server/types/controllers/RepeatableQuestController.d.ts b/Live/CWX_MasterKey/server/types/controllers/RepeatableQuestController.d.ts index 98d05dd..4c31a3d 100644 --- a/Live/CWX_MasterKey/server/types/controllers/RepeatableQuestController.d.ts +++ b/Live/CWX_MasterKey/server/types/controllers/RepeatableQuestController.d.ts @@ -7,6 +7,7 @@ import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; import { TraderInfo } from "../models/eft/common/tables/IBotBase"; import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; import { ELocationName } from "../models/enums/ELocationName"; @@ -15,6 +16,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -64,9 +66,10 @@ export declare class RepeatableQuestController { protected itemEventRouter: ItemEventRouter; protected paymentService: PaymentService; protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. @@ -217,4 +220,16 @@ export declare class RepeatableQuestController { debugLogRepeatableQuestIds(pmcData: IPmcData): void; probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; changeRepeatableQuest(pmcDataIn: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {*} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; } diff --git a/Live/CWX_MasterKey/server/types/controllers/TraderController.d.ts b/Live/CWX_MasterKey/server/types/controllers/TraderController.d.ts index 7bab158..b79f55e 100644 --- a/Live/CWX_MasterKey/server/types/controllers/TraderController.d.ts +++ b/Live/CWX_MasterKey/server/types/controllers/TraderController.d.ts @@ -4,6 +4,7 @@ import { TraderHelper } from "../helpers/TraderHelper"; import { IBarterScheme, ITraderAssort, ITraderBase } from "../models/eft/common/tables/ITrader"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -15,12 +16,29 @@ export declare class TraderController { protected traderHelper: TraderHelper; protected timeUtil: TimeUtil; protected traderAssortService: TraderAssortService; + protected fenceService: FenceService; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, fenceService: FenceService, jsonUtil: JsonUtil); + /** + * Runs when onLoad event is fired + * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Store timestamp of next assort refresh in nextResupply property of traders .base object + */ load(): void; - getTrader(traderID: string, sessionID: string): ITraderBase; + /** + * Runs when onUpdate is fired + * If current time is > nextResupply(expire) time of trader, refresh traders assorts and + * Fence is handled slightly differently + * @returns has run + */ + update(): boolean; + /** + * Return an array of all traders + * @param sessionID Session id + * @returns array if ITraderBase objects + */ getAllTraders(sessionID: string): ITraderBase[]; - updateTraders(): boolean; + getTrader(sessionID: string, traderID: string): ITraderBase; getAssort(sessionId: string, traderId: string): ITraderAssort; - getPurchasesData(traderID: string, sessionID: string): Record; + getPurchasesData(sessionID: string, traderID: string): Record; } diff --git a/Live/CWX_MasterKey/server/types/di/Container.d.ts b/Live/CWX_MasterKey/server/types/di/Container.d.ts index 17791b0..98d1fa1 100644 --- a/Live/CWX_MasterKey/server/types/di/Container.d.ts +++ b/Live/CWX_MasterKey/server/types/di/Container.d.ts @@ -1,4 +1,7 @@ import { DependencyContainer } from "tsyringe"; +/** + * Handle the registration of classes to be used by the Dependency Injection code + */ export declare class Container { static registerTypes(depContainer: DependencyContainer): void; static registerListTypes(depContainer: DependencyContainer): void; diff --git a/Live/CWX_MasterKey/server/types/generators/BotGenerator.d.ts b/Live/CWX_MasterKey/server/types/generators/BotGenerator.d.ts index a5fc0ad..2ac51db 100644 --- a/Live/CWX_MasterKey/server/types/generators/BotGenerator.d.ts +++ b/Live/CWX_MasterKey/server/types/generators/BotGenerator.d.ts @@ -9,6 +9,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { PmcAiService } from "../services/PmcAiService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -30,9 +31,10 @@ export declare class BotGenerator { protected botEquipmentFilterService: BotEquipmentFilterService; protected botHelper: BotHelper; protected gameEventHelper: GameEventHelper; + protected pmcAiService: PmcAiService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, pmcAiService: PmcAiService, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -40,14 +42,14 @@ export declare class BotGenerator { * @param botTemplate base bot template to use (e.g. assault/pmcbot) * @returns */ - generatePlayerScav(role: string, difficulty: string, botTemplate: IBotType): IBotBase; - generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Choose if a bot should become a PMC by checking if bot type is allowed to become a Pmc in botConfig.convertFromChances and doing a random int check - * @param botRole the bot role to check if should be a pmc - * @returns true if should be a pmc + * Generate an array of bot objects for populate a raid with + * @param sessionId session id + * @param info request object + * @returns bot array */ - protected shouldBotBePmc(botRole: string): boolean; + generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** * Get a randomised PMC side based on bot config value 'isUsec' * @returns pmc side as string @@ -58,12 +60,30 @@ export declare class BotGenerator { * @returns IBotBase object */ protected getCloneOfBotBase(): IBotBase; - protected generateBot(bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + /** + * Create a IBotBase object with equipment/loot/exp etc + * @param sessionId Session id + * @param bot bots base file + * @param role botRole bot will use + * @param node Bot template from db/bots/x.json + * @param isPmc Is bot to be a PMC + * @param isPlayerScav is bot to be a p scav bot + * @returns IBotBase object + */ + protected generateBot(sessionId: string, bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; /** * Log the number of PMCs generated to the debug console + * @param output Generated bot array, ready to send to client */ protected logPmcGeneratedCount(output: IBotBase[]): void; - protected generateRandomLevel(min: number, max: number): BotGenerator.IRandomisedBotLevelResult; + /** + * Return a randomised bot level and exp value + * @param role botRole being generated for + * @param min Min exp value + * @param max Max exp value + * @returns IRandomisedBotLevelResult object + */ + protected generateRandomLevel(role: string, min: number, max: number): BotGenerator.IRandomisedBotLevelResult; /** * Converts health object to the required format * @param healthObj health object from bot json @@ -72,19 +92,23 @@ export declare class BotGenerator { */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; protected generateSkills(skillsObj: Skills): Skills; - /** - * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) - * @param pmcSide eft side (usec/bear) - * @returns pmc side as defined in config - */ - protected getPmcRole(pmcSide: string): string; /** * Iterate through bots inventory and loot to find and remove christmas items (as defined in GameEventHelper) * @param nodeInventory Bots inventory to iterate over */ protected removeChristmasItemsFromBotInventory(nodeInventory: Inventory): void; + /** + * Generate a random Id for a bot and apply to bots _id and aid value + * @param bot bot to update + * @returns updated IBotBase object + */ protected generateId(bot: IBotBase): IBotBase; protected generateInventoryID(profile: IBotBase): IBotBase; + /** + * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * @param requestedDifficulty + * @returns + */ protected getPMCDifficulty(requestedDifficulty: string): string; /** * Add a side-specific (usec/bear) dogtag item to a bots inventory diff --git a/Live/CWX_MasterKey/server/types/generators/BotInventoryGenerator.d.ts b/Live/CWX_MasterKey/server/types/generators/BotInventoryGenerator.d.ts index 35d1ee8..c5ed545 100644 --- a/Live/CWX_MasterKey/server/types/generators/BotInventoryGenerator.d.ts +++ b/Live/CWX_MasterKey/server/types/generators/BotInventoryGenerator.d.ts @@ -1,13 +1,16 @@ +import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Inventory, Chances, Generation, Mods } from "../models/eft/common/tables/IBotType"; +import { Chances, Generation, Inventory, Mods } from "../models/eft/common/tables/IBotType"; +import { EquipmentSlots } from "../models/enums/EquipmentSlots"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; -import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; -import { BotWeaponGenerator } from "./BotWeaponGenerator"; import { BotLootGenerator } from "./BotLootGenerator"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; +import { BotWeaponGenerator } from "./BotWeaponGenerator"; export declare class BotInventoryGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -17,8 +20,14 @@ export declare class BotInventoryGenerator { protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper); - generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { + slot: EquipmentSlots; + shouldSpawn: boolean; + }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; protected generateInventoryBase(): PmcInventory; } diff --git a/Live/CWX_MasterKey/server/types/generators/BotLootGenerator.d.ts b/Live/CWX_MasterKey/server/types/generators/BotLootGenerator.d.ts index c6a3f29..c1f5310 100644 --- a/Live/CWX_MasterKey/server/types/generators/BotLootGenerator.d.ts +++ b/Live/CWX_MasterKey/server/types/generators/BotLootGenerator.d.ts @@ -1,4 +1,5 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; @@ -20,11 +21,12 @@ export declare class BotLootGenerator { protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botLootCacheService: BotLootCacheService, configServer: ConfigServer); - generateLoot(templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer); + generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached @@ -47,7 +49,7 @@ export declare class BotLootGenerator { * @param botRole bots role, .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; /** * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from diff --git a/Live/CWX_MasterKey/server/types/generators/BotWeaponGenerator.d.ts b/Live/CWX_MasterKey/server/types/generators/BotWeaponGenerator.d.ts index 9215214..487901b 100644 --- a/Live/CWX_MasterKey/server/types/generators/BotWeaponGenerator.d.ts +++ b/Live/CWX_MasterKey/server/types/generators/BotWeaponGenerator.d.ts @@ -1,4 +1,5 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { MinMax } from "../models/common/MinMax"; @@ -14,6 +15,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { IInventoryMagGen } from "./weapongen/IInventoryMagGen"; export declare class BotWeaponGenerator { protected jsonUtil: JsonUtil; protected logger: ILogger; @@ -24,11 +26,24 @@ export declare class BotWeaponGenerator { protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; protected configServer: ConfigServer; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, inventoryMagGenComponents: IInventoryMagGen[]); /** - * Get a random weapon from a bots pool of weapons (weighted) + * Pick a random weapon based on weightings and generate a functional weapon + * @param equipmentSlot Primary/secondary/holster + * @param botTemplateInventory e.g. assault.json + * @param weaponParentId + * @param modChances + * @param botRole role of bot, e.g. assault/followerBully + * @param isPmc Is weapon generated for a pmc + * @returns GenerateWeaponResult object + */ + generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + /** + * Get a random weighted weapon from a bots pool of weapons * @param equipmentSlot Primary/secondary/holster * @param botTemplateInventory e.g. assault.json * @returns weapon tpl @@ -39,43 +54,24 @@ export declare class BotWeaponGenerator { * @param weaponTpl weapon tpl to generate (use pickWeightedWeaponTplFromPool()) * @param equipmentSlot slot to fit into, primary/secondary/holster * @param botTemplateInventory e.g. assault.json - * @param weaponParentId - * @param modChances - * @param botRole + * @param weaponParentId ParentId of the weapon being generated + * @param modChances Dictionary of item types and % chance weapon will have that mod + * @param botRole e.g. assault/exusec * @param isPmc * @returns GenerateWeaponResult object */ - generateWeaponByTpl(weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; /** - * Generate an entirely random weapon - * @param equipmentSlot Primary/secondary/holster - * @param botTemplateInventory e.g. assault.json - * @param weaponParentId - * @param modChances - * @param botRole - * @param isPmc - * @returns GenerateWeaponResult object - */ - generateRandomWeapon(equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; - /** - * Create array with weapon base as only element - * Add additional properties as required - * @param weaponTpl - * @param weaponParentId - * @param equipmentSlot - * @param weaponItemTemplate + * Create array with weapon base as only element and + * add additional properties based on weapon type + * @param weaponTpl Weapon tpl to create item with + * @param weaponParentId Weapons parent id + * @param equipmentSlot e.g. primary/secondary/holster + * @param weaponItemTemplate db template for weapon * @param botRole for durability values - * @returns + * @returns Base weapon item in array */ - constructWeaponBaseArray(weaponTpl: string, weaponParentId: string, equipmentSlot: string, weaponItemTemplate: ITemplateItem, botRole: string): Item[]; - /** - * Add compatible magazines to an inventory based on a generated weapon - * @param weaponDetails - * @param magCounts - * @param inventory - * @param botRole the bot type we're getting generating extra mags for - */ - addExtraMagazinesToInventory(weaponDetails: GenerateWeaponResult, magCounts: MinMax, inventory: PmcInventory, botRole: string): void; + protected constructWeaponBaseArray(weaponTpl: string, weaponParentId: string, equipmentSlot: string, weaponItemTemplate: ITemplateItem, botRole: string): Item[]; /** * Get the mods necessary to kit out a weapon to its preset level * @param weaponTpl weapon to find preset for @@ -84,33 +80,21 @@ export declare class BotWeaponGenerator { * @returns array of weapon mods */ protected getPresetWeaponMods(weaponTpl: string, equipmentSlot: string, weaponParentId: string, itemTemplate: ITemplateItem, botRole: string): Item[]; - /** Checks if all required slots are occupied on a weapon and all it's mods */ + /** + * Checks if all required slots are occupied on a weapon and all it's mods + * @param weaponItemArray Weapon + mods + * @returns true if valid + */ protected isWeaponValid(weaponItemArray: Item[]): boolean; /** * Generates extra magazines or bullets (if magazine is internal) and adds them to TacticalVest and Pockets. * Additionally, adds extra bullets to SecuredContainer - * @param weaponMods - * @param weaponTemplate - * @param magCounts - * @param ammoTpl - * @param inventory - * @param botRole the bot type we're getting generating extra mags for - * @returns + * @param generatedWeaponResult object with properties for generated weapon (weapon mods pool / weapon template / ammo tpl) + * @param magCounts Magazine count to add to inventory + * @param inventory Inventory to add magazines to + * @param botRole The bot type we're getting generating extra mags for */ - protected generateExtraMagazines(weaponMods: Item[], weaponTemplate: ITemplateItem, magCounts: MinMax, ammoTpl: string, inventory: PmcInventory, botRole: string): void; - /** - * Get a randomised number of bullets for a specific magazine - * @param magCounts min and max count of magazines - * @param magTemplate magazine to generate bullet count for - * @returns bullet count number - */ - protected getRandomisedBulletCount(magCounts: MinMax, magTemplate: ITemplateItem): number; - /** - * Get a randomised count of magazines - * @param magCounts min and max value returned value can be between - * @returns numberical value of magazine count - */ - protected getRandomisedMagazineCount(magCounts: MinMax): number; + addExtraMagazinesToInventory(generatedWeaponResult: GenerateWeaponResult, magCounts: MinMax, inventory: PmcInventory, botRole: string): void; /** * Add ammo to the secure container * @param stackCount How many stacks of ammo to add @@ -127,21 +111,13 @@ export declare class BotWeaponGenerator { * @returns magazine tpl string */ protected getMagazineTplFromWeaponTemplate(weaponMods: Item[], weaponTemplate: ITemplateItem, botRole: string): string; - /** - * Get a weapons default magazine template id - * @param weaponTemplate weapon to get default magazine for - * @returns tpl of magazine - */ - protected getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - protected addBulletsToVestAndPockets(ammoTpl: string, bulletCount: number, inventory: PmcInventory): void; /** * Finds and return a compatible ammo tpl based on the bots ammo weightings (x.json/inventory/equipment/ammo) * @param ammo a list of ammo tpls the weapon can use * @param weaponTemplate the weapon we want to pick ammo for - * @param isPmc is the ammo being gathered for a pmc (runs pmc ammo filtering) * @returns an ammo tpl that works with the desired gun */ - protected getCompatibleAmmo(ammo: Record>, weaponTemplate: ITemplateItem, isPmc: boolean): string; + protected getWeightedCompatibleAmmo(ammo: Record>, weaponTemplate: ITemplateItem): string; /** * Get a weapons compatible cartridge caliber * @param weaponTemplate Weapon to look up caliber of diff --git a/Live/CWX_MasterKey/server/types/generators/LocationGenerator.d.ts b/Live/CWX_MasterKey/server/types/generators/LocationGenerator.d.ts index bd368b5..cc61dcf 100644 --- a/Live/CWX_MasterKey/server/types/generators/LocationGenerator.d.ts +++ b/Live/CWX_MasterKey/server/types/generators/LocationGenerator.d.ts @@ -3,10 +3,9 @@ import { GameEventHelper } from "../helpers/GameEventHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; -import { ILooseLoot, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; +import { ILooseLoot, SpawnpointsForced, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; import { Item } from "../models/eft/common/tables/IItem"; import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticLootDetails } from "../models/eft/common/tables/ILootBase"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -36,11 +35,19 @@ export declare class LocationGenerator { generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; + /** + * Create array of loose + forced loot using probability system + * @param dynamicLootDist + * @param staticAmmoDist + * @param locationName Location to generate loot for + * @returns Array of spawn points with loot in them + */ generateDynamicLoot(dynamicLootDist: ILooseLoot, staticAmmoDist: Record, locationName: string): SpawnpointTemplate[]; + /** + * Add forced spawn point loot into loot parameter array + * @param loot array to add forced loot to + * @param forcedSpawnPoints forced loot to add + */ + protected addForcedLoot(loot: SpawnpointTemplate[], forcedSpawnPoints: SpawnpointsForced[]): void; protected createItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; - protected getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; - protected getRandomValidCaliber(magTemplate: ITemplateItem): string; - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; - protected createRandomMagCartridges(magTemplate: ITemplateItem, parentId: string, staticAmmoDist: Record, caliber?: string): Item; - protected createCartidges(parentId: string, ammoTpl: string, stackCount: number): Item; } diff --git a/Live/CWX_MasterKey/server/types/generators/LootGenerator.d.ts b/Live/CWX_MasterKey/server/types/generators/LootGenerator.d.ts new file mode 100644 index 0000000..bbc1915 --- /dev/null +++ b/Live/CWX_MasterKey/server/types/generators/LootGenerator.d.ts @@ -0,0 +1,58 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Preset } from "../models/eft/common/IGlobals"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { LootItem } from "../models/spt/services/LootItem"; +import { LootRequest } from "../models/spt/services/LootRequest"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { HashUtil } from "../utils/HashUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class LootGenerator { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected databaseServer: DatabaseServer; + protected randomUtil: RandomUtil; + protected itemHelper: ItemHelper; + protected itemFilterService: ItemFilterService; + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, itemFilterService: ItemFilterService); + /** + * Generate a list of items based on options passed in + * @param options parameters to adjust what loot is generated + * @returns An array of loot items + */ + createRandomloot(options: LootRequest): LootItem[]; + /** + * Construct item limit record to hold max and current item count + * @param limits limits as defined in config + * @returns record, key: item tplId, value: current/max item count allowed + */ + protected initItemLimitCounter(limits: Record): Record; + /** + * Find a random item in items.json and add to result array + * @param items items to choose from + * @param itemTypeCounts item limit counts + * @param options item filters + * @param result array to add found item to + * @returns true if item was valid and added to pool + */ + protected findAndAddRandomItemToLoot(items: [string, ITemplateItem][], itemTypeCounts: Record, options: LootRequest, result: LootItem[]): boolean; + /** + * + * Find a random item in items.json and add to result array + * @param globalDefaultPresets presets to choose from + * @param itemTypeCounts item limit counts + * @param result array to add found preset to + * @returns true if preset was valid and added to pool + */ + protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, Preset][], itemTypeCounts: Record, result: LootItem[]): boolean; +} diff --git a/Live/CWX_MasterKey/server/types/generators/PMCLootGenerator.d.ts b/Live/CWX_MasterKey/server/types/generators/PMCLootGenerator.d.ts index 64e6f7f..b9f2a83 100644 --- a/Live/CWX_MasterKey/server/types/generators/PMCLootGenerator.d.ts +++ b/Live/CWX_MasterKey/server/types/generators/PMCLootGenerator.d.ts @@ -1,15 +1,21 @@ import { ItemHelper } from "../helpers/ItemHelper"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ConfigServer } from "../servers/ConfigServer"; import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +/** + * Handle the generation of dynamic PMC loot in pockets and backpacks + * and the removal of blacklisted items + */ export declare class PMCLootGenerator { protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; + protected itemFilterService: ItemFilterService; protected pocketLootPool: string[]; protected backpackLootPool: string[]; protected botConfig: IBotConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService); generatePMCPocketLootPool(): string[]; generatePMCBackpackLootPool(): string[]; } diff --git a/Live/CWX_MasterKey/server/types/generators/RagfairAssortGenerator.d.ts b/Live/CWX_MasterKey/server/types/generators/RagfairAssortGenerator.d.ts index cbdd7f2..db4811d 100644 --- a/Live/CWX_MasterKey/server/types/generators/RagfairAssortGenerator.d.ts +++ b/Live/CWX_MasterKey/server/types/generators/RagfairAssortGenerator.d.ts @@ -1,5 +1,8 @@ import { ItemHelper } from "../helpers/ItemHelper"; +import { Preset } from "../models/eft/common/IGlobals"; import { Item } from "../models/eft/common/tables/IItem"; +import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -8,18 +11,40 @@ export declare class RagfairAssortGenerator { protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; protected generatedAssortItems: Item[]; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer); + protected ragfairConfig: IRagfairConfig; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); /** * Get an array of unique items that can be sold on the flea * @returns array of unique items */ getAssortItems(): Item[]; + /** + * Check internal generatedAssortItems array has objects + * @returns true if array has objects + */ protected assortsAreGenerated(): boolean; /** * Generate an array of items the flea can sell * @returns array of unique items */ protected generateRagfairAssortItems(): Item[]; + /** + * Get presets from globals.json + * @returns Preset object array + */ + protected getPresets(): Preset[]; + /** + * Get default presets from globals.json + * @returns Preset object array + */ + protected getDefaultPresets(): Preset[]; + /** + * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true + * @param tplId tplid to add to item + * @param id id to add to item + * @returns hydrated Item object + */ protected createRagfairAssortItem(tplId: string, id?: string): Item; } diff --git a/Live/CWX_MasterKey/server/types/generators/RagfairOfferGenerator.d.ts b/Live/CWX_MasterKey/server/types/generators/RagfairOfferGenerator.d.ts index 3e7f4cc..317cd6b 100644 --- a/Live/CWX_MasterKey/server/types/generators/RagfairOfferGenerator.d.ts +++ b/Live/CWX_MasterKey/server/types/generators/RagfairOfferGenerator.d.ts @@ -41,15 +41,37 @@ export declare class RagfairOfferGenerator { createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; protected getTraderId(userID: string): string; protected getRating(userID: string): number; + /** + * Is the offers user rating growing + * @param userID user to check rating of + * @returns true if its growing + */ protected getRatingGrowing(userID: string): boolean; + /** + * Get number of section until offer should expire + * @param userID Id of the offer owner + * @param time Time the offer is posted + * @returns number of seconds until offer expires + */ protected getOfferEndTime(userID: string, time: number): number; /** * Create multiple offers for items by using a unique list of items we've generated previously - * @param expiredOffers + * @param expiredOffers optional, expired offers to regenerate */ generateDynamicOffers(expiredOffers?: Item[]): void; - generateTraderOffers(traderID: string): void; + /** + * Generate trader offers on flea using the traders assort data + * @param traderID Trader to generate offers for + */ + generateFleaOffersForTrader(traderID: string): void; protected getItemCondition(userID: string, items: Item[], itemDetails: ITemplateItem): Item[]; + /** + * Add missing conditions to an item if needed + * Durabiltiy for repairable items + * HpResource for medical items + * @param item item to add conditions to + * @returns Item with conditions added + */ protected addMissingCondition(item: Item): Item; protected getOfferRequirements(items: Item[]): { count: number; @@ -57,6 +79,14 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a flea offer and store it in the Ragfair server offers array + * @param userID owner of the offer + * @param time time offer is put up + * @param items items in the offer + * @param barterScheme + * @param loyalLevel + * @param price price of offer + * @param sellInOnePiece + * @returns */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/Live/CWX_MasterKey/server/types/generators/ScavCaseRewardGenerator.d.ts b/Live/CWX_MasterKey/server/types/generators/ScavCaseRewardGenerator.d.ts index c7d6ab7..89cb5c8 100644 --- a/Live/CWX_MasterKey/server/types/generators/ScavCaseRewardGenerator.d.ts +++ b/Live/CWX_MasterKey/server/types/generators/ScavCaseRewardGenerator.d.ts @@ -8,9 +8,13 @@ import { RewardCountAndPriceDetails, ScavCaseRewardCountsAndPrices } from "../mo import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { RagfairPriceService } from "../services/RagfairPriceService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +/** + * Handle the creation of randomised scav case rewards + */ export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; @@ -18,9 +22,10 @@ export declare class ScavCaseRewardGenerator { protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param body client request diff --git a/Live/CWX_MasterKey/server/types/generators/WeatherGenerator.d.ts b/Live/CWX_MasterKey/server/types/generators/WeatherGenerator.d.ts index 44cecbb..8ddbe49 100644 --- a/Live/CWX_MasterKey/server/types/generators/WeatherGenerator.d.ts +++ b/Live/CWX_MasterKey/server/types/generators/WeatherGenerator.d.ts @@ -1,7 +1,7 @@ import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { ConfigServer } from "../servers/ConfigServer"; import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class WeatherGenerator { @@ -21,11 +21,16 @@ export declare class WeatherGenerator { protected getAcceleratedTime(computedDate: Date): string; /** * Get current time formatted to fit BSGs requirement - * @param computedDate + * @param computedDate date to format into bsg style * @returns */ protected getNormalTime(computedDate: Date): string; - generateWeather(data: IWeatherData): IWeatherData; + /** + * Return randomised Weather data + * @param weatherData weather input data + * @returns Randomised weather data + */ + generateWeather(weatherData: IWeatherData): IWeatherData; protected getWeightedFog(): string; protected getWeightedRain(): number; protected getRandomFloat(node: string): number; diff --git a/Live/CWX_MasterKey/server/types/generators/weapongen/IInventoryMagGen.d.ts b/Live/CWX_MasterKey/server/types/generators/weapongen/IInventoryMagGen.d.ts new file mode 100644 index 0000000..792f510 --- /dev/null +++ b/Live/CWX_MasterKey/server/types/generators/weapongen/IInventoryMagGen.d.ts @@ -0,0 +1,6 @@ +import { InventoryMagGen } from "./InventoryMagGen"; +export interface IInventoryMagGen { + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_MasterKey/server/types/generators/weapongen/InventoryMagGen.d.ts b/Live/CWX_MasterKey/server/types/generators/weapongen/InventoryMagGen.d.ts new file mode 100644 index 0000000..30bf79f --- /dev/null +++ b/Live/CWX_MasterKey/server/types/generators/weapongen/InventoryMagGen.d.ts @@ -0,0 +1,16 @@ +import { MinMax } from "../../models/common/MinMax"; +import { Inventory } from "../../models/eft/common/tables/IBotBase"; +import { ITemplateItem } from "../../models/eft/common/tables/ITemplateItem"; +export declare class InventoryMagGen { + private magCounts; + private magazineTemplate; + private weaponTemplate; + private ammoTemplate; + private pmcInventory; + constructor(magCounts: MinMax, magazineTemplate: ITemplateItem, weaponTemplate: ITemplateItem, ammoTemplate: ITemplateItem, pmcInventory: Inventory); + getMagCount(): MinMax; + getMagazineTemplate(): ITemplateItem; + getWeaponTemplate(): ITemplateItem; + getAmmoTemplate(): ITemplateItem; + getPmcInventory(): Inventory; +} diff --git a/Live/CWX_MasterKey/server/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts b/Live/CWX_MasterKey/server/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts new file mode 100644 index 0000000..b754d5f --- /dev/null +++ b/Live/CWX_MasterKey/server/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts @@ -0,0 +1,12 @@ +import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; +import { RandomUtil } from "../../../utils/RandomUtil"; +import { IInventoryMagGen } from "../IInventoryMagGen"; +import { InventoryMagGen } from "../InventoryMagGen"; +export declare class BarrelInventoryMagGen implements IInventoryMagGen { + protected randomUtil: RandomUtil; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + constructor(randomUtil: RandomUtil, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_MasterKey/server/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/Live/CWX_MasterKey/server/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts new file mode 100644 index 0000000..4fcb1e2 --- /dev/null +++ b/Live/CWX_MasterKey/server/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -0,0 +1,14 @@ +import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; +import { ItemHelper } from "../../../helpers/ItemHelper"; +import { ILogger } from "../../../models/spt/utils/ILogger"; +import { IInventoryMagGen } from "../IInventoryMagGen"; +import { InventoryMagGen } from "../InventoryMagGen"; +export declare class ExternalInventoryMagGen implements IInventoryMagGen { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + constructor(logger: ILogger, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_MasterKey/server/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts b/Live/CWX_MasterKey/server/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts new file mode 100644 index 0000000..4548a04 --- /dev/null +++ b/Live/CWX_MasterKey/server/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts @@ -0,0 +1,10 @@ +import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; +import { IInventoryMagGen } from "../IInventoryMagGen"; +import { InventoryMagGen } from "../InventoryMagGen"; +export declare class InternalMagazineInventoryMagGen implements IInventoryMagGen { + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + constructor(botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_MasterKey/server/types/helpers/AssortHelper.d.ts b/Live/CWX_MasterKey/server/types/helpers/AssortHelper.d.ts index 15586b9..bfc157f 100644 --- a/Live/CWX_MasterKey/server/types/helpers/AssortHelper.d.ts +++ b/Live/CWX_MasterKey/server/types/helpers/AssortHelper.d.ts @@ -17,7 +17,7 @@ export declare class AssortHelper { * @param assort assort items from a trader * @returns assort items minus locked quest assorts */ - stripLockedQuestAssort(pmcProfile: IPmcData, traderId: string, assort: ITraderAssort): ITraderAssort; + stripLockedQuestAssort(pmcProfile: IPmcData, traderId: string, assort: ITraderAssort, flea?: boolean): ITraderAssort; /** * Remove assorts from a trader that have not been unlocked yet * @param pmcProfile player profile @@ -32,5 +32,5 @@ export declare class AssortHelper { * @param itemID item id to remove from asort * @returns Modified assort */ - removeItemFromAssort(assort: ITraderAssort, itemID: string): ITraderAssort; + removeItemFromAssort(assort: ITraderAssort, itemID: string, flea?: boolean): ITraderAssort; } diff --git a/Live/CWX_MasterKey/server/types/helpers/BotGeneratorHelper.d.ts b/Live/CWX_MasterKey/server/types/helpers/BotGeneratorHelper.d.ts index 3cd7256..5e3e501 100644 --- a/Live/CWX_MasterKey/server/types/helpers/BotGeneratorHelper.d.ts +++ b/Live/CWX_MasterKey/server/types/helpers/BotGeneratorHelper.d.ts @@ -1,19 +1,33 @@ import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper"; -import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem"; -import { Grid, ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { ItemFilterService } from "../services/ItemFilterService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotWeaponGeneratorHelper } from "./BotWeaponGeneratorHelper"; import { ContainerHelper } from "./ContainerHelper"; import { InventoryHelper } from "./InventoryHelper"; import { ItemHelper } from "./ItemHelper"; import { ProbabilityHelper } from "./ProbabilityHelper"; +import { ProfileHelper } from "./ProfileHelper"; +export declare class BotModLimits { + scope: ItemCount; + scopeMax: number; + scopeBaseTypes: string[]; + flashlightLaser: ItemCount; + flashlightLaserMax: number; + flashlgihtLaserBaseTypes: string[]; +} +export declare class ItemCount { + count: number; +} export declare class BotGeneratorHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -25,16 +39,121 @@ export declare class BotGeneratorHelper { protected itemHelper: ItemHelper; protected inventoryHelper: InventoryHelper; protected containerHelper: ContainerHelper; + protected botEquipmentFilterService: BotEquipmentFilterService; + protected itemFilterService: ItemFilterService; + protected profileHelper: ProfileHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, configServer: ConfigServer); - generateModsForItem(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, configServer: ConfigServer); /** - * Is this magazine cylinder related (revolvers and grenade launchers) - * @param magazineParentName the name of the magazines parent - * @returns true if it is cylinder related + * Check mods are compatible and add to array + * @param equipment Equipment item to add mods to + * @param modPool Mod list to choose frm + * @param parentId parentid of item to add mod to + * @param parentTemplate template objet of item to add mods to + * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @returns Item + compatible mods as an array */ - magazineIsCylinderRelated(magazineParentName: string): boolean; + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + /** + * @param sessionId session id + * @param weapon Weapon to add mods to + * @param modPool Pool of compatible mods to attach to weapon + * @param weaponParentId parentId of weapon + * @param parentWeaponTemplate Weapon which mods will be generated on + * @param modSpawnChances Mod spawn chances + * @param ammoTpl Ammo tpl to use when generating magazines/cartridges + * @param botRole Role of bot weapon is generated for + * @returns Weapon + mods array + */ + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; + /** + * + * @param modSlot + * @param isRandomisableSlot + * @param modsParent + * @param botEquipBlacklist + * @param itemModPool + * @param weapon array with only weapon tpl in it, ready for mods to be added + * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) + * @param parentTemplate + * @returns + */ + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + /** + * Find mod tpls of a provided type and add to modPool + * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) + * @param modTemplate db object for modItem we get compatible mods from + * @param modPool Pool of mods we are adding to + */ + protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; + /** + * Check if mod item is on limited list + has surpassed the limit set for it + * @param botRole role the bot has e.g. assault + * @param modTemplate mods template data + * @param modLimits limits set for weapon being generated for this bot + * @returns true if over item limit + */ + protected modHasReachedItemLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits): boolean; + /** + * Initalise mod limits to be used when generating a weapon + * @param botRole "assault", "bossTagilla" or "pmc" + * @returns BotModLimits object + */ + protected initModLimits(botRole: string): BotModLimits; + /** + * Generate a pool of mods for this bots mod type if bot has values inside `randomisedWeaponModSlots` array found in bot.json/equipment[botrole] + * @param allowedMods Mods to be added to mod pool + * @param botEquipBlacklist blacklist of items not allowed to be added to mod pool + * @param modSlot Slot to generate mods for + * @param itemModPool base mod pool to replace values of + */ + protected generateDynamicWeaponModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record): void; + /** + * Find all compatible mods for equipment item and add to modPool + * @param itemDetails item to find mods for + * @param modPool ModPool to add mods to + */ + generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods): void; + /** + * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist + * @param allowedMods base mods to filter + * @param botEquipBlacklist equipment blacklist + * @param modSlot slot mods belong to + * @returns Filtered array of mod tpls + */ + protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; + /** + * Check if the specific item type on the weapon has reached the set limit + * @param modTpl log mod tpl if over type limit + * @param currentCount current number of this item on gun + * @param maxLimit mod limit allowed + * @param botRole role of bot we're checking weapon of + * @returns true if limit reached + */ + protected weaponModLimitReached(modTpl: string, currentCount: { + count: number; + }, maxLimit: number, botRole: string): boolean; + /** + * Log errors if mod is not compatible with slot + * @param modToAdd template of mod to check + * @param itemSlot slot the item will be placed in + * @param modSlot slot the mod will fill + * @param parentTemplate tempalte of the mods parent item + * @returns true if valid + */ + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + /** + * Create a mod item with parameters as properties + * @param modId _id + * @param modTpl _tpl + * @param parentId parentId + * @param modSlot slotId + * @param modTemplate Used to add additional properites in the upd object + * @returns Item object + */ + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem): Item; /** * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance @@ -46,7 +165,7 @@ export declare class BotGeneratorHelper { protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; /** * Get a list of containers that hold ammo - * e.g. mod_magazine + * e.g. mod_magazine / patron_in_weapon_000 * @returns string array */ protected getAmmoContainers(): string[]; @@ -62,11 +181,11 @@ export declare class BotGeneratorHelper { * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" - * - * @param {object} items The items where the CylinderMagazine's camora are appended to - * @param {object} modPool modPool which should include available cartrigdes - * @param {string} parentId The CylinderMagazine's UID - * @param {object} parentTemplate The CylinderMagazine's template + * @param items The items where the CylinderMagazine's camora are appended to + * @param modPool modPool which should include available cartrigdes + * @param parentId The CylinderMagazine's UID + * @param parentTemplate The CylinderMagazine's template + * @returns */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** @@ -75,6 +194,13 @@ export declare class BotGeneratorHelper { * @returns string array of shells fro luitple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + /** + * Adds properties to an item + * e.g. Repairable / HasHinge / Foldable / MaxDurability + * @param itemTemplate + * @param botRole Used by weapons to randomise the durability values + * @returns Item Upd object with extra properties + */ generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { upd?: Upd; }; @@ -92,13 +218,15 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; - protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** - * Sort by spawn chance, highest to lowest, higher is more common - * @param unsortedModArray String array to sort - * @returns Sorted string array + * Get a random mod from an items compatible mods Filter array + * @param modTpl + * @param parentSlot + * @param modSlot + * @param items + * @returns item tpl */ - protected sortModArray(unsortedModArray: string[]): string[]; + protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** * Can an item be added to an item without issue * @param items @@ -107,18 +235,8 @@ export declare class BotGeneratorHelper { * @returns true if possible */ isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; - /** - * Adds an item with all its childern into specified equipmentSlots, wherever it fits. - * @param equipmentSlots - * @param parentId - * @param parentTpl - * @param itemWithChildren - * @param inventory - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: PmcInventory): boolean; - protected itemAllowedInContainer(slot: Grid, itemTpl: string): boolean; } +/** TODO - move into own class */ export declare class ExhaustableArray { private itemPool; private randomUtil; diff --git a/Live/CWX_MasterKey/server/types/helpers/BotHelper.d.ts b/Live/CWX_MasterKey/server/types/helpers/BotHelper.d.ts index 9b89481..18738e5 100644 --- a/Live/CWX_MasterKey/server/types/helpers/BotHelper.d.ts +++ b/Live/CWX_MasterKey/server/types/helpers/BotHelper.d.ts @@ -13,11 +13,34 @@ export declare class BotHelper { protected configServer: ConfigServer; protected botConfig: IBotConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, configServer: ConfigServer); + /** + * Get difficulty settings for desired bot type, if not found use assault bot types + * @param type bot type to retreive difficulty of + * @param difficulty difficulty to get settings for (easy/normal etc) + * @returns Difficulty object + */ getBotDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Get a template object for the specified botRole from bots.types db + * @param role botRole to get template for + * @returns IBotType object + */ getBotTemplate(role: string): IBotType; + /** + * Get difficulty settings for a PMC + * @param type "usec" / "bear" + * @param difficulty what difficulty to retrieve + * @returns Difficulty object + */ getPmcDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Choose a random difficulty from - easy/normal/hard/impossible + * @returns random difficulty + */ + chooseRandomDifficulty(): string; /** * Randomise the chance the PMC will attack their own side + * Look up value in bot.json/chanceSameSideIsHostilePercent * @param difficultySettings pmc difficulty settings */ randomisePmcHostility(difficultySettings: Difficulty): void; @@ -31,7 +54,7 @@ export declare class BotHelper { */ addBotToFriendlyList(difficultySettings: Difficulty, typeToAdd: string): void; /** - * Add a bot to the ENEMY_BOT_TYPES array + * Add a bot to the ENEMY_BOT_TYPES array, do not add itself if its on the enemy list * @param difficultySettings bot settings to alter * @param typesToAdd bot type to add to enemy list */ @@ -42,4 +65,10 @@ export declare class BotHelper { * @param typesToAdd bot type to add to revenge list */ addBotToRevengeList(difficultySettings: Difficulty, typesToAdd: string[]): void; + /** + * Choose if a bot should become a PMC by checking if bot type is allowed to become a Pmc in botConfig.convertFromChances and doing a random int check + * @param botRole the bot role to check if should be a pmc + * @returns true if should be a pmc + */ + shouldBotBePmc(botRole: string): boolean; } diff --git a/Live/CWX_MasterKey/server/types/helpers/BotWeaponGeneratorHelper.d.ts b/Live/CWX_MasterKey/server/types/helpers/BotWeaponGeneratorHelper.d.ts new file mode 100644 index 0000000..7e25f56 --- /dev/null +++ b/Live/CWX_MasterKey/server/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -0,0 +1,78 @@ +import { MinMax } from "../models/common/MinMax"; +import { Inventory } from "../models/eft/common/tables/IBotBase"; +import { Item } from "../models/eft/common/tables/IItem"; +import { Grid, ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { HashUtil } from "../utils/HashUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { ContainerHelper } from "./ContainerHelper"; +import { InventoryHelper } from "./InventoryHelper"; +import { ItemHelper } from "./ItemHelper"; +export declare class BotWeaponGeneratorHelper { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper); + /** + * Get a randomised number of bullets for a specific magazine + * @param magCounts min and max count of magazines + * @param magTemplate magazine to generate bullet count for + * @returns bullet count number + */ + getRandomisedBulletCount(magCounts: MinMax, magTemplate: ITemplateItem): number; + /** + * Get a randomised count of magazines + * @param magCounts min and max value returned value can be between + * @returns numberical value of magazine count + */ + getRandomisedMagazineCount(magCounts: MinMax): number; + /** + * Is this magazine cylinder related (revolvers and grenade launchers) + * @param magazineParentName the name of the magazines parent + * @returns true if it is cylinder related + */ + magazineIsCylinderRelated(magazineParentName: string): boolean; + /** + * Create a magazine using the parameters given + * @param magazineTpl Tpl of the magazine to create + * @param ammoTpl Ammo to add to magazine + * @param magTemplate template object of magazine + * @returns Item array + */ + createMagazine(magazineTpl: string, ammoTpl: string, magTemplate: ITemplateItem): Item[]; + /** + * Add a specific number of cartrdiges to a bots inventory (vest/pocket) + * @param ammoTpl Ammo tpl to add to vest/pockets + * @param cartridgeCount number of cartridges to add to vest/pockets + * @param inventory bot inventory to add cartridges to + */ + addBulletsToVestAndPockets(ammoTpl: string, cartridgeCount: number, inventory: Inventory): void; + /** + * Get a weapons default magazine template id + * @param weaponTemplate weapon to get default magazine for + * @returns tpl of magazine + */ + getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; + /** + * Adds an item with all its childern into specified equipmentSlots, wherever it fits. + * @param equipmentSlots + * @param parentId + * @param parentTpl + * @param itemWithChildren + * @param inventory + * @returns a `boolean` indicating item was added + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): boolean; + /** + * is the provided item allowed inside a container + * @param slot location item wants to be placed in + * @param itemTpl item being placed + * @returns true if allowed + */ + protected itemAllowedInContainer(slot: Grid, itemTpl: string): boolean; +} diff --git a/Live/CWX_MasterKey/server/types/helpers/HideoutHelper.d.ts b/Live/CWX_MasterKey/server/types/helpers/HideoutHelper.d.ts index 36e4009..7495a6a 100644 --- a/Live/CWX_MasterKey/server/types/helpers/HideoutHelper.d.ts +++ b/Live/CWX_MasterKey/server/types/helpers/HideoutHelper.d.ts @@ -44,14 +44,72 @@ export declare class HideoutHelper { initProduction(recipeId: string, productionTime: number): Production; isProductionType(productive: Productive): productive is Production; applyPlayerUpgradesBonuses(pmcData: IPmcData, bonus: StageBonus): void; + /** + * TODO: + * After looking at the skills there doesnt seem to be a configuration per skill to boost + * the XP gain PER skill. I THINK you should be able to put the variable "SkillProgress" (just like health has it) + * and be able to tune the skill gain PER skill, but I havent tested it and Im not sure! + * @param pmcData + * @param bonus + */ protected applySkillXPBoost(pmcData: IPmcData, bonus: StageBonus): void; + /** + * Process a players hideout, update areas that use resources + increment production timers + * @param sessionID Session id + */ updatePlayerHideout(sessionID: string): void; + /** + * Update progress timer for water collector + * @param pmcData profile to update + * @param productionId id of water collection production to update + * @param hideoutProperties Hideout properties + */ + protected updateWaterCollectorProductionTimer(pmcData: IPmcData, productionId: string, hideoutProperties: { + btcFarmCGs?: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Update progress timer for scav case + * @param pmcData Profile to update + * @param productionId Id of scav case production to update + */ + protected updateScavCaseProductionTimer(pmcData: IPmcData, productionId: string): void; + /** + * Iterate over hideout areas that use resources (fuel/filters etc) and update associated values + * @param sessionID Session id + * @param pmcData Profile to update areas of + * @param hideoutProperties hideout properties + */ + protected updateAreasWithResources(sessionID: string, pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): HideoutArea; - protected updateWaterFilters(waterFilterArea: HideoutArea, pwProd: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; + /** + * Adjust water filter objects resourceValue or delete when they reach 0 resource + * @param waterFilterArea water filter area to update + * @param production production object + * @param isGeneratorOn is generatory enabled + * @param pmcData Player profile + * @returns Updated HideoutArea object + */ + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): HideoutArea; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; protected getBTCSlots(pmcData: IPmcData): number; protected getManagementSkillsSlots(): number; diff --git a/Live/CWX_MasterKey/server/types/helpers/InRaidHelper.d.ts b/Live/CWX_MasterKey/server/types/helpers/InRaidHelper.d.ts index c3cbfbb..962df38 100644 --- a/Live/CWX_MasterKey/server/types/helpers/InRaidHelper.d.ts +++ b/Live/CWX_MasterKey/server/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -15,19 +16,8 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); - /** - * Reset the SPT inraid property stored in a profile to 'none' - * @param sessionID Session id - */ - protected removePlayer(sessionID: string): void; - /** - * Some maps have one-time-use keys (e.g. Labs - * Remove the relevant key from an inventory based on the post-raid request data passed in - * @param offraidData post-raid data - * @param sessionID Session id - */ - protected removeMapAccessKey(offraidData: ISaveProgressRequestData, sessionID: string): void; + protected profileFixerService: ProfileFixerService; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); /** * Check an array of items and add an upd object to money items with a stack count of 1 * Single stack money items have no upd object and thus no StackObjectsCount, causing issues @@ -52,6 +42,18 @@ export declare class InRaidHelper { * @returns Reset profile object */ updateProfileBaseStats(profileData: IPmcData, saveProgressRequest: ISaveProgressRequestData, sessionID: string): IPmcData; + /** + * Some maps have one-time-use keys (e.g. Labs + * Remove the relevant key from an inventory based on the post-raid request data passed in + * @param offraidData post-raid data + * @param sessionID Session id + */ + protected removeMapAccessKey(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Set the SPT inraid location Profile property to 'none' + * @param sessionID Session id + */ + protected setPlayerInRaidLocationStatusToNone(sessionID: string): void; /** * Adds SpawnedInSession property to items found in a raid * Removes SpawnedInSession for non-scav players if item was taken into raid with SpawnedInSession = true @@ -93,5 +95,10 @@ export declare class InRaidHelper { * @returns true if item is kept after death */ isItemKeptAfterDeath(slotId: string): boolean; + /** + * Return the equipped items from a players inventory + * @param items Players inventory to search through + * @returns an array of equipped items + */ getPlayerGear(items: Item[]): Item[]; } diff --git a/Live/CWX_MasterKey/server/types/helpers/InventoryHelper.d.ts b/Live/CWX_MasterKey/server/types/helpers/InventoryHelper.d.ts index dc7cbca..b8e5c9d 100644 --- a/Live/CWX_MasterKey/server/types/helpers/InventoryHelper.d.ts +++ b/Live/CWX_MasterKey/server/types/helpers/InventoryHelper.d.ts @@ -43,6 +43,7 @@ export declare class InventoryHelper { constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; diff --git a/Live/CWX_MasterKey/server/types/helpers/ItemHelper.d.ts b/Live/CWX_MasterKey/server/types/helpers/ItemHelper.d.ts index 1701c62..0effaf2 100644 --- a/Live/CWX_MasterKey/server/types/helpers/ItemHelper.d.ts +++ b/Live/CWX_MasterKey/server/types/helpers/ItemHelper.d.ts @@ -1,35 +1,30 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { InsuredItem } from "../models/eft/common/tables/IBotBase"; import { Item, Repairable } from "../models/eft/common/tables/IItem"; +import { IStaticAmmoDetails } from "../models/eft/common/tables/ILootBase"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ObjectId } from "../utils/ObjectId"; +import { RandomUtil } from "../utils/RandomUtil"; declare class ItemHelper { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected randomUtil: RandomUtil; + protected objectId: ObjectId; + protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer); /** - * Checks if a id is a valid item. Valid meaning that it's an item that be stored in stash + * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl * @returns boolean; true for items that may be in player posession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {*} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - isValidRewardItem(tpl: string): boolean; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - getRewardableItems(): [string, ITemplateItem][]; /** * Check if the tpl / template Id provided is a descendent of the baseclass * @@ -84,6 +79,11 @@ declare class ItemHelper { * @returns {array} The array of StackSlotItems */ generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; + /** + * Get cloned copy of all item data from items.json + * @returns array of ITemplateItem objects + */ + getItems(): ITemplateItem[]; /** * Gets item data from items.json * @param tpl items template id to look up @@ -196,6 +196,22 @@ declare class ItemHelper { * @returns ItemSize object (width and height) */ getItemSize(items: Item[], rootItemId: string): ItemHelper.ItemSize; + /** + * Get a random cartridge from an items Filter property + * @param item + * @returns + */ + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + createRandomMagCartridges(magTemplate: ITemplateItem, parentId: string, staticAmmoDist: Record, caliber?: string): Item; + protected getRandomValidCaliber(magTemplate: ITemplateItem): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + createCartidges(parentId: string, ammoTpl: string, stackCount: number): Item; + /** + * Get the size of a stack, return 1 if no stack object count property found + * @param item Item to get stack size of + * @returns size of stack + */ + getItemStackSize(item: Item): number; } declare namespace ItemHelper { interface ItemSize { diff --git a/Live/CWX_MasterKey/server/types/helpers/ProfileHelper.d.ts b/Live/CWX_MasterKey/server/types/helpers/ProfileHelper.d.ts index 6c150c8..9c6560a 100644 --- a/Live/CWX_MasterKey/server/types/helpers/ProfileHelper.d.ts +++ b/Live/CWX_MasterKey/server/types/helpers/ProfileHelper.d.ts @@ -2,24 +2,41 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Stats } from "../models/eft/common/tables/IBotBase"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; +import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { ItemHelper } from "./ItemHelper"; export declare class ProfileHelper { + protected logger: ILogger; protected jsonUtil: JsonUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected profileSnapshotService: ProfileSnapshotService; protected fenceService: FenceService; - constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; getCompleteProfile(sessionID: string): IPmcData[]; + /** + * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen + * Server saves the post-raid changes prior to the xp screen getting the profile, this results in the xp screen using + * the now updated profile values as a base, meaning it shows x2 xp gained + * Instead, clone the post-raid profile (so we dont alter its values), apply the pre-raid xp values to the cloned objects and return + * Delete snapshot of pre-raid profile prior to returning profile data + * @param sessionId Session id + * @param output pmc and scav profiles array + * @param pmcProfile post-raid pmc profile + * @param scavProfile post-raid scav profile + * @returns updated profile array + */ + protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; /** * Add experience to a PMC inside the players profile diff --git a/Live/CWX_MasterKey/server/types/helpers/QuestHelper.d.ts b/Live/CWX_MasterKey/server/types/helpers/QuestHelper.d.ts index 0f68cd5..d66d150 100644 --- a/Live/CWX_MasterKey/server/types/helpers/QuestHelper.d.ts +++ b/Live/CWX_MasterKey/server/types/helpers/QuestHelper.d.ts @@ -36,13 +36,30 @@ export declare class QuestHelper { protected configServer: ConfigServer; protected questConfig: IQuestConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); - questStatus(pmcData: IPmcData, questID: string): QuestStatus; /** - * returns true is the condition is satisfied + * Get status of a quest by quest id + * @param pmcData Profile to search + * @param questID Quest id to look up + * @returns QuestStauts enum + */ + getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus; + /** + * returns true is the level condition is satisfied + * @param playerLevel Players level + * @param condition Quest condition + * @returns true if player level is greater than or equal to quest */ - evaluateLevel(pmcProfile: IPmcData, cond: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; - rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progress: number): void; + /** + * Increase skill points of a skill on player profile + * @param sessionID Session id + * @param pmcData Player profile + * @param output output object to send back to client + * @param skillName Name of skill to increase skill points of + * @param progressAmount Amount of skill points to add to skill + */ + rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; getQuestLocale(questId: string): any; /** * Debug Routine for showing some information on the diff --git a/Live/CWX_MasterKey/server/types/helpers/RagfairOfferHelper.d.ts b/Live/CWX_MasterKey/server/types/helpers/RagfairOfferHelper.d.ts index 8d03bee..e9d72ca 100644 --- a/Live/CWX_MasterKey/server/types/helpers/RagfairOfferHelper.d.ts +++ b/Live/CWX_MasterKey/server/types/helpers/RagfairOfferHelper.d.ts @@ -22,12 +22,14 @@ import { ProfileHelper } from "./ProfileHelper"; import { RagfairHelper } from "./RagfairHelper"; import { RagfairServerHelper } from "./RagfairServerHelper"; import { RagfairSortHelper } from "./RagfairSortHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class RagfairOfferHelper { protected logger: ILogger; protected timeUtil: TimeUtil; protected hashUtil: HashUtil; protected itemEventRouter: ItemEventRouter; protected databaseServer: DatabaseServer; + protected traderHelper: TraderHelper; protected saveServer: SaveServer; protected dialogueHelper: DialogueHelper; protected itemHelper: ItemHelper; @@ -43,10 +45,10 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; - processOffers(sessionID: string): boolean; + processOffersOnProfile(sessionID: string): boolean; protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; diff --git a/Live/CWX_MasterKey/server/types/helpers/RagfairSellHelper.d.ts b/Live/CWX_MasterKey/server/types/helpers/RagfairSellHelper.d.ts index 6ec004a..91b8a20 100644 --- a/Live/CWX_MasterKey/server/types/helpers/RagfairSellHelper.d.ts +++ b/Live/CWX_MasterKey/server/types/helpers/RagfairSellHelper.d.ts @@ -11,6 +11,12 @@ export declare class RagfairSellHelper { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateSellChance(baseChance: number, offerPrice: number, requirementsPriceInRub: number): number; - rollForSale(sellChance: number, count: number): SellResult[]; + calculateSellChance(baseChancePercent: number, offerPriceRub: number, playerListedPriceRub: number): number; + /** + * Determine if the offer being listed will be sold + * @param sellChancePercent chance item will sell + * @param itemSellCount count of items to sell + * @returns Array of purchases of item(s) lsited + */ + rollForSale(sellChancePercent: number, itemSellCount: number): SellResult[]; } diff --git a/Live/CWX_MasterKey/server/types/helpers/RagfairServerHelper.d.ts b/Live/CWX_MasterKey/server/types/helpers/RagfairServerHelper.d.ts index e4939d1..a03cdda 100644 --- a/Live/CWX_MasterKey/server/types/helpers/RagfairServerHelper.d.ts +++ b/Live/CWX_MasterKey/server/types/helpers/RagfairServerHelper.d.ts @@ -6,6 +6,7 @@ import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -13,6 +14,9 @@ import { RandomUtil } from "../utils/RandomUtil"; import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { ProfileHelper } from "./ProfileHelper"; +/** + * Helper class for common ragfair server actions + */ export declare class RagfairServerHelper { protected randomUtil: RandomUtil; protected hashUtil: HashUtil; @@ -23,11 +27,12 @@ export declare class RagfairServerHelper { protected localeService: LocaleService; protected dialogueHelper: DialogueHelper; protected jsonUtil: JsonUtil; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; protected static goodsReturnedTemplate: string; - constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); + constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Is item valid / on blacklist / quest item * @param itemDetails diff --git a/Live/CWX_MasterKey/server/types/helpers/RepairHelper.d.ts b/Live/CWX_MasterKey/server/types/helpers/RepairHelper.d.ts index 9a3ab29..5b09320 100644 --- a/Live/CWX_MasterKey/server/types/helpers/RepairHelper.d.ts +++ b/Live/CWX_MasterKey/server/types/helpers/RepairHelper.d.ts @@ -14,8 +14,17 @@ export declare class RepairHelper { protected configServer: ConfigServer; protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); - updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit?: boolean, applyRandomDegradation?: boolean): Item; - protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number): number; - protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, armorMax: number): number; + /** + * + * @param itemToRepair item to update durability details + * @param itemToRepairDetails db details of item to repair + * @param isArmor Is item being repaired a piece of armor + * @param amountToRepair how many unit of durability to repair + * @param useRepairKit Is item being repaired with a repair kit + * @param applyMaxDurabilityDegradation should item have max durability reduced + */ + updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit: boolean, traderQualityMultipler: number, applyMaxDurabilityDegradation?: boolean): void; + protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number, traderQualityMultipler: number): number; + protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, weaponMax: number, traderQualityMultipler: number): number; isWeaponTemplate(tpl: string): boolean; } diff --git a/Live/CWX_MasterKey/server/types/helpers/TradeHelper.d.ts b/Live/CWX_MasterKey/server/types/helpers/TradeHelper.d.ts index 975062b..7ab9768 100644 --- a/Live/CWX_MasterKey/server/types/helpers/TradeHelper.d.ts +++ b/Live/CWX_MasterKey/server/types/helpers/TradeHelper.d.ts @@ -39,6 +39,12 @@ export declare class TradeHelper { * @returns */ sellItem(pmcData: IPmcData, body: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Increment the assorts buy count by number of items purchased + * Show error on screen if player attepts 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; protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/Live/CWX_MasterKey/server/types/helpers/TraderAssortHelper.d.ts b/Live/CWX_MasterKey/server/types/helpers/TraderAssortHelper.d.ts index 91ba6b9..025efd6 100644 --- a/Live/CWX_MasterKey/server/types/helpers/TraderAssortHelper.d.ts +++ b/Live/CWX_MasterKey/server/types/helpers/TraderAssortHelper.d.ts @@ -1,7 +1,7 @@ import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator"; import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; import { Item } from "../models/eft/common/tables/IItem"; -import { ITraderAssort } from "../models/eft/common/tables/ITrader"; +import { ITrader, ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -10,13 +10,16 @@ import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; +import { TimeUtil } from "../utils/TimeUtil"; import { AssortHelper } from "./AssortHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class TraderAssortHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; protected mathUtil: MathUtil; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected assortHelper: AssortHelper; @@ -24,18 +27,32 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts + * Filter out assorts not unlocked due to level OR quest completion * @param sessionId session id - * @param traderId trader id - * @returns a traders assorts + * @param traderId traders id + * @returns a traders' assorts */ - getAssort(sessionId: string, traderId: string): ITraderAssort; + getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset a traders assorts and move nextResupply value to future + * Flag trader as needing a flea offer reset to be picked up by flea update() function + * @param trader trader details to alter + */ + resetExpiredTrader(trader: ITrader): void; + /** + * Does the supplied trader need its assorts refreshed + * @param traderID Trader to check + * @returns true they need refreshing + */ + traderAssortsHaveExpired(traderID: string): boolean; /** * Iterate over all assorts barter_scheme values, find barters selling for money and multiply by multipler in config * @param traderAssort Assorts to multiple price of diff --git a/Live/CWX_MasterKey/server/types/helpers/TraderHelper.d.ts b/Live/CWX_MasterKey/server/types/helpers/TraderHelper.d.ts index b2e9d38..0dc93e8 100644 --- a/Live/CWX_MasterKey/server/types/helpers/TraderHelper.d.ts +++ b/Live/CWX_MasterKey/server/types/helpers/TraderHelper.d.ts @@ -9,6 +9,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { PlayerService } from "../services/PlayerService"; +import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -23,9 +24,10 @@ export declare class TraderHelper { protected handbookHelper: HandbookHelper; protected playerService: PlayerService; protected fenceService: FenceService; + protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -63,7 +65,7 @@ export declare class TraderHelper { * @param item * @returns boolean */ - protected isWeaponAndBelowTraderBuyDurability(traderID: string, item: Item): boolean; + protected isWeaponBelowTraderBuyDurability(traderID: string, item: Item): boolean; /** * Get the price of an item and all of its attached children * Take into account bonuses/adjsutments e.g. discounts @@ -97,6 +99,17 @@ export declare class TraderHelper { * @param sessionID session id */ lvlUp(traderID: string, sessionID: string): void; + /** + * Get the next update timestamp for a trader + * @param traderID Trader to look up update value for + * @returns future timestamp + */ + getNextUpdateTimestamp(traderID: string): number; + /** + * Get the reset time between trader assort refreshes in seconds + * @param traderId Trader to look up + * @returns Time in seconds + */ getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader diff --git a/Live/CWX_MasterKey/server/types/loaders/PreAkiModLoader.d.ts b/Live/CWX_MasterKey/server/types/loaders/PreAkiModLoader.d.ts index 6ded3c6..4ab1689 100644 --- a/Live/CWX_MasterKey/server/types/loaders/PreAkiModLoader.d.ts +++ b/Live/CWX_MasterKey/server/types/loaders/PreAkiModLoader.d.ts @@ -33,9 +33,20 @@ export declare class PreAkiModLoader implements IModLoader { protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; /** - * - * @param mods Get an array of broken/invalid mods by name - * @returns Mod names array + * Check for duplciate mods loaded, show error if duplicate mod found + * @param modPackageData dictionary of mod package.json data + */ + protected checkForDuplicateMods(modPackageData: Record): void; + /** + * Check for and return duplicate strings inside an array + * @param stringArray Array to check for duplicates + * @returns string array of duplicates, empty if none found + */ + protected getDuplicates(stringArray: string[]): string[]; + /** + * Get an array of mods with errors that prevent them from working with SPT + * @param mods mods to validate + * @returns Mod names as array */ protected getBrokenMods(mods: string[]): string[]; /** @@ -57,7 +68,12 @@ export declare class PreAkiModLoader implements IModLoader { protected addMod(mod: string): Promise; protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record): boolean; protected isModCompatible(mod: IPackageJsonData, loadedMods: Record): boolean; - protected validMod(mod: string): boolean; + /** + * Validate a mod passes a number of checks + * @param modName name of mod in /mods/ to validate + * @returns true if valid + */ + protected validMod(modName: string): boolean; protected getLoadOrderRecursive(mod: string, result: Record, visited: Record): void; protected getLoadOrder(mods: Record): Record; getContainer(): DependencyContainer; diff --git a/Live/CWX_MasterKey/server/types/models/eft/common/IGlobals.d.ts b/Live/CWX_MasterKey/server/types/models/eft/common/IGlobals.d.ts index 9d28dbc..81e2023 100644 --- a/Live/CWX_MasterKey/server/types/models/eft/common/IGlobals.d.ts +++ b/Live/CWX_MasterKey/server/types/models/eft/common/IGlobals.d.ts @@ -1175,5 +1175,6 @@ export interface Preset { _name: string; _parent: string; _items: Item[]; + /** Default presets have this property */ _encyclopedia?: string; } diff --git a/Live/CWX_MasterKey/server/types/models/eft/common/ILocationBase.d.ts b/Live/CWX_MasterKey/server/types/models/eft/common/ILocationBase.d.ts index b1dd448..78ade9a 100644 --- a/Live/CWX_MasterKey/server/types/models/eft/common/ILocationBase.d.ts +++ b/Live/CWX_MasterKey/server/types/models/eft/common/ILocationBase.d.ts @@ -137,7 +137,7 @@ export interface BotLocationModifier { VisibleDistance: number; } export interface MinMaxBot { - WildSpawnType: string; + WildSpawnType: WildSpawnType; max: number; min: number; } @@ -195,7 +195,7 @@ export interface Wave { BotPreset: string; BotSide: string; SpawnPoints: string; - WildSpawnType: string; + WildSpawnType: WildSpawnType; isPlayers: boolean; number: number; slots_max: number; @@ -203,3 +203,7 @@ export interface Wave { time_max: number; time_min: number; } +export declare enum WildSpawnType { + ASSAULT = "assault", + MARKSMAN = "marksman" +} diff --git a/Live/CWX_MasterKey/server/types/models/eft/common/tables/IBotBase.d.ts b/Live/CWX_MasterKey/server/types/models/eft/common/tables/IBotBase.d.ts index 0ee468e..25cb861 100644 --- a/Live/CWX_MasterKey/server/types/models/eft/common/tables/IBotBase.d.ts +++ b/Live/CWX_MasterKey/server/types/models/eft/common/tables/IBotBase.d.ts @@ -28,6 +28,8 @@ export interface IBotBase { CarExtractCounts: CarExtractCounts; SurvivorClass: SurvivorClass; WishList: string[]; + /** SPT specific property used during bot generation in raid */ + sptIsPmc?: boolean; } export interface Info { EntryPoint: string; @@ -66,13 +68,13 @@ export interface IBan { dateTime: number; } export declare enum BanType { - Chat = 0, - RagFair = 1, - Voip = 2, - Trading = 3, - Online = 4, - Friends = 5, - ChangeNickname = 6 + CHAT = 0, + RAGFAIR = 1, + VOIP = 2, + TRADING = 3, + ONLINE = 4, + FRIENDS = 5, + CHANGE_NICKNAME = 6 } export interface Customization { Head: string; @@ -312,11 +314,11 @@ export interface Notes { export interface CarExtractCounts { } export declare enum SurvivorClass { - Unknown = 0, - Neutralizer = 1, - Marauder = 2, - Paramedic = 3, - Survivor = 4 + UNKNOWN = 0, + NEUTRALIZER = 1, + MARAUDER = 2, + PARAMEDIC = 3, + SURVIVOR = 4 } export interface Quest { qid: string; diff --git a/Live/CWX_MasterKey/server/types/models/eft/common/tables/ITemplateItem.d.ts b/Live/CWX_MasterKey/server/types/models/eft/common/tables/ITemplateItem.d.ts index 23a1a14..8569e61 100644 --- a/Live/CWX_MasterKey/server/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/Live/CWX_MasterKey/server/types/models/eft/common/tables/ITemplateItem.d.ts @@ -34,6 +34,7 @@ export interface Props { LootExperience?: number; ExamineExperience?: number; HideEntrails?: boolean; + InsuranceDisabled?: boolean; RepairCost?: number; RepairSpeed?: number; ExtraSizeLeft?: number; @@ -79,7 +80,7 @@ export interface Props { HasShoulderContact?: boolean; SightingRange?: number; DoubleActionAccuracyPenaltyMult?: number; - ModesCount: any; + ModesCount?: any; DurabilityBurnModificator?: number; HeatFactor?: number; CoolFactor?: number; @@ -155,7 +156,7 @@ export interface Props { RigLayoutName?: string; MaxDurability?: number; armorZone?: string[]; - armorClass: any; + armorClass?: any; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -206,6 +207,7 @@ export interface Props { IsOneoff?: boolean; MustBoltBeOpennedForExternalReload?: boolean; MustBoltBeOpennedForInternalReload?: boolean; + NoFiremodeOnBoltcatch?: boolean; BoltAction?: boolean; HipAccuracyRestorationDelay?: number; HipAccuracyRestorationSpeed?: number; @@ -252,8 +254,8 @@ export interface Props { foodUseTime?: number; foodEffectType?: string; StimulatorBuffs?: string; - effects_health: any; - effects_damage: any; + effects_health?: any; + effects_damage?: any; MaximumNumberOfUsage?: number; knifeHitDelay?: number; knifeHitSlashRate?: number; diff --git a/Live/CWX_MasterKey/server/types/models/eft/common/tables/ITrader.d.ts b/Live/CWX_MasterKey/server/types/models/eft/common/tables/ITrader.d.ts index f0fe2b5..37b2d61 100644 --- a/Live/CWX_MasterKey/server/types/models/eft/common/tables/ITrader.d.ts +++ b/Live/CWX_MasterKey/server/types/models/eft/common/tables/ITrader.d.ts @@ -7,7 +7,7 @@ export interface ITrader { suits?: ISuit[]; } export interface ITraderBase { - refreshAssort: boolean; + refreshTraderRagfairOffers: boolean; _id: string; avatar: string; balance_dol: number; @@ -58,7 +58,7 @@ export interface Repair { quality: string; } export interface ITraderAssort { - nextResupply?: number; + nextResupply: number; items: Item[]; barter_scheme: Record; loyal_level_items: Record; @@ -67,6 +67,7 @@ export interface IBarterScheme { count: number; _tpl: string; onlyFunctional?: boolean; + sptQuestLocked?: boolean; } export interface ISuit { _id: string; diff --git a/Live/CWX_MasterKey/server/types/models/eft/health/Effect.d.ts b/Live/CWX_MasterKey/server/types/models/eft/health/Effect.d.ts index 2f0adac..7eb3ffc 100644 --- a/Live/CWX_MasterKey/server/types/models/eft/health/Effect.d.ts +++ b/Live/CWX_MasterKey/server/types/models/eft/health/Effect.d.ts @@ -1,5 +1,5 @@ export declare enum Effect { - Fracture = "Fracture", - LightBleeding = "LightBleeding", - HeavyBleeding = "HeavyBleeding" + FRACTURE = "Fracture", + LIGHT_BLEEDING = "LightBleeding", + HEAVY_BLEEDING = "HeavyBleeding" } diff --git a/Live/CWX_MasterKey/server/types/models/eft/health/IOffraidHealRequestData.d.ts b/Live/CWX_MasterKey/server/types/models/eft/health/IOffraidHealRequestData.d.ts index c242300..26b02bd 100644 --- a/Live/CWX_MasterKey/server/types/models/eft/health/IOffraidHealRequestData.d.ts +++ b/Live/CWX_MasterKey/server/types/models/eft/health/IOffraidHealRequestData.d.ts @@ -7,12 +7,12 @@ export interface IOffraidHealRequestData extends IBaseInteractionRequestData { time: number; } export declare enum BodyPart { - Head = 0, - Chest = 1, - Stomach = 2, - LeftArm = 3, - RightArm = 4, - LeftLeg = 5, - RightLeg = 6, - Common = 7 + HEAD = "Head", + CHEST = "Chest", + STOMACH = "Stomach", + LEFT_ARM = "LeftArm", + RIGHT_ARM = "RightArm", + LEFT_LEG = "LeftLeg", + RIGHT_LEG = "RightLeg", + COMMON = "Common" } diff --git a/Live/CWX_MasterKey/server/types/models/eft/notifier/INotifier.d.ts b/Live/CWX_MasterKey/server/types/models/eft/notifier/INotifier.d.ts index 8c48260..b248636 100644 --- a/Live/CWX_MasterKey/server/types/models/eft/notifier/INotifier.d.ts +++ b/Live/CWX_MasterKey/server/types/models/eft/notifier/INotifier.d.ts @@ -1,9 +1,9 @@ export interface INotifierChannel { - "server": string; - "channel_id": string; - "url": string; - "notifierServer": string; - "ws": string; + server: string; + channel_id: string; + url: string; + notifierServer: string; + ws: string; } import { Message } from "../profile/IAkiProfile"; export interface INotification { diff --git a/Live/CWX_MasterKey/server/types/models/eft/ragfair/IRagfairOffer.d.ts b/Live/CWX_MasterKey/server/types/models/eft/ragfair/IRagfairOffer.d.ts index 63f655e..141b605 100644 --- a/Live/CWX_MasterKey/server/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/Live/CWX_MasterKey/server/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -15,6 +15,8 @@ export interface IRagfairOffer { name?: string; shortName?: string; loyaltyLevel: number; + buyRestrictionMax?: number; + buyRestrictionCurrent?: number; locked: boolean; unlimitedCount: boolean; summaryCost: number; diff --git a/Live/CWX_MasterKey/server/types/models/enums/AmmoTypes.d.ts b/Live/CWX_MasterKey/server/types/models/enums/AmmoTypes.d.ts index b52ddcf..254b410 100644 --- a/Live/CWX_MasterKey/server/types/models/enums/AmmoTypes.d.ts +++ b/Live/CWX_MasterKey/server/types/models/enums/AmmoTypes.d.ts @@ -23,7 +23,7 @@ export declare enum Ammo762x54 { BT_GZH = "5e023d34e8a400319a28ed44", BS_GZH = "5e023d48186a883be655e551" } -export declare enum Ammo338Lapua { +export declare enum Ammo86x70 { TAC_X = "5fc382b6d6fa9c00c571bbc3", UCW = "5fc382c1016cce60e8341b20", AP = "5fc382a9d724d907e2077dab", @@ -85,13 +85,13 @@ export declare enum Ammo9x21 { PE_GZH = "5a26ac06c4a282000c5a90a8", BT_GZH = "5a26ac0ec4a28200741e1e18" } -export declare enum Ammo357Mag { +export declare enum Ammo9x33R { FMJ = "62330b3ed4dc74626d570b95", HOLLOW_POINT = "62330bfadc5883093563729b", SOFT_POINT = "62330c40bdd19b369e1e53d1", JACKET_HP = "62330c18744e5e31df12f516" } -export declare enum Ammo45ACP { +export declare enum Ammo1143x23ACP { MATCH_FMJ = "5e81f423763d9f754677bf2e", HYDRA_SHOK = "5efb0fc6aeb21837e749c801", LASERMATCH_FMJ = "5efb0d4f4bc50b58e81710f3", @@ -126,7 +126,7 @@ export declare enum Ammo556x45 { MK_318_MOD_0_SOST = "60194943740c5d77f6705eea", SSA_AP = "601949593ae8f707c4608daa" } -export declare enum Ammo300Blackout { +export declare enum Ammo762x35 { M62_TRACER = "619636be6db0f2477964e710", BCP_FMJ = "5fbe3ffdf8b6a877a729ea82", AP = "5fd20ff893a8961fc660a954", diff --git a/Live/CWX_MasterKey/server/types/models/enums/BaseClasses.d.ts b/Live/CWX_MasterKey/server/types/models/enums/BaseClasses.d.ts index e733bca..36ebc71 100644 --- a/Live/CWX_MasterKey/server/types/models/enums/BaseClasses.d.ts +++ b/Live/CWX_MasterKey/server/types/models/enums/BaseClasses.d.ts @@ -25,6 +25,7 @@ export declare enum BaseClasses { SIGHTS = "5448fe7a4bdc2d6f028b456b", MEDS = "543be5664bdc2dd4348b4569", MONEY = "543be5dd4bdc2deb348b4569", + NIGHTVISION = "5a2c3a9486f774688b05e574", KEY = "543be5e94bdc2df1348b4568", KEY_MECHANICAL = "5c99f98d86f7745c314214b3", KEYCARD = "5c164d2286f774194c5e69fa", @@ -66,8 +67,8 @@ export declare enum BaseClasses { LUBRICANT = "57864e4c24597754843f8723", BATTERY = "57864ee62459775490116fc1", ASSAULT_SCOPE = "55818add4bdc2d5b648b456f", - REFLEX_SIGHT = "55818ad54bdc2ddc698b4569", TACTICAL_COMBO = "55818b164bdc2ddc698b456c", + FLASHLIGHT = "55818b084bdc2d5b648b4571", MAGAZINE = "5448bc234bdc2d3c308b4569", LIGHT_LASER = "55818b0e4bdc2dde698b456e", FLASH_HIDER = "550aa4bf4bdc2dd6348b456b", diff --git a/Live/CWX_MasterKey/server/types/models/enums/BotAmount.d.ts b/Live/CWX_MasterKey/server/types/models/enums/BotAmount.d.ts index d0e1df1..9ef9cab 100644 --- a/Live/CWX_MasterKey/server/types/models/enums/BotAmount.d.ts +++ b/Live/CWX_MasterKey/server/types/models/enums/BotAmount.d.ts @@ -1,7 +1,7 @@ export declare enum BotAmount { - AsOnline = "AsOnline", - Low = "Low", - Medium = "Medium", - High = "High", - Horde = "Horde" + AS_ONLINE = "AsOnline", + LOW = "Low", + MEDIUM = "Medium", + HIGH = "High", + HORDE = "Horde" } diff --git a/Live/CWX_MasterKey/server/types/models/enums/BotDifficulty.d.ts b/Live/CWX_MasterKey/server/types/models/enums/BotDifficulty.d.ts index c901bcf..80e45ad 100644 --- a/Live/CWX_MasterKey/server/types/models/enums/BotDifficulty.d.ts +++ b/Live/CWX_MasterKey/server/types/models/enums/BotDifficulty.d.ts @@ -1,8 +1,8 @@ export declare enum BotDifficulty { - AsOnline = "AsOnline", - Easy = "Easy", - Medium = "Medium", - Hard = "Hard", - Impossible = "Impossible", - Random = "Random" + AS_ONLINE = "AsOnline", + EASY = "Easy", + MEDIUM = "Medium", + HARD = "Hard", + IMPOSSIBLE = "Impossible", + RANDOM = "Random" } diff --git a/Live/CWX_MasterKey/server/types/models/enums/ConfigTypes.d.ts b/Live/CWX_MasterKey/server/types/models/enums/ConfigTypes.d.ts index 61d6f99..468ece5 100644 --- a/Live/CWX_MasterKey/server/types/models/enums/ConfigTypes.d.ts +++ b/Live/CWX_MasterKey/server/types/models/enums/ConfigTypes.d.ts @@ -8,6 +8,7 @@ export declare enum ConfigTypes { IN_RAID = "aki-inraid", INSURANCE = "aki-insurance", INVENTORY = "aki-inventory", + ITEM = "aki-item", LOCALE = "aki-locale", LOCATION = "aki-location", MATCH = "aki-match", diff --git a/Live/CWX_MasterKey/server/types/models/enums/ELocationName.d.ts b/Live/CWX_MasterKey/server/types/models/enums/ELocationName.d.ts index b56cc08..7ae7caa 100644 --- a/Live/CWX_MasterKey/server/types/models/enums/ELocationName.d.ts +++ b/Live/CWX_MasterKey/server/types/models/enums/ELocationName.d.ts @@ -1,5 +1,6 @@ export declare enum ELocationName { FACTORY_DAY = "factory4_day", + FACTORY_NIGHT = "factory4_night", BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", diff --git a/Live/CWX_MasterKey/server/types/models/enums/MemberCategory.d.ts b/Live/CWX_MasterKey/server/types/models/enums/MemberCategory.d.ts index 3bd9a21..a81380e 100644 --- a/Live/CWX_MasterKey/server/types/models/enums/MemberCategory.d.ts +++ b/Live/CWX_MasterKey/server/types/models/enums/MemberCategory.d.ts @@ -1,13 +1,13 @@ export declare enum MemberCategory { - Default = 0, - Developer = 1, - UniqueId = 2, - Trader = 4, - Group = 8, - System = 16, - ChatModerator = 32, - ChatModeratorWithPermanentBan = 64, - UnitTest = 128, - Sherpa = 256, - Emissary = 512 + DEFAULT = 0, + DEVELOPER = 1, + UNIQUE_ID = 2, + TRADER = 4, + GROUP = 8, + SYSTEM = 16, + CHAT_MODERATOR = 32, + CHAT_MODERATOR_WITH_PERMANENT_BAN = 64, + UNIT_TEST = 128, + SHERPA = 256, + EMISSARY = 512 } diff --git a/Live/CWX_MasterKey/server/types/models/enums/QuestRewardType.d.ts b/Live/CWX_MasterKey/server/types/models/enums/QuestRewardType.d.ts index 1d3db86..16f7e39 100644 --- a/Live/CWX_MasterKey/server/types/models/enums/QuestRewardType.d.ts +++ b/Live/CWX_MasterKey/server/types/models/enums/QuestRewardType.d.ts @@ -1,8 +1,8 @@ export declare enum QuestRewardType { - Skill = "Skill", - Experience = "Experience", - TraderStanding = "TraderStanding", - TraderUnlock = "TraderUnlock", - Item = "Item", - AssortmentUnlock = "AssortmentUnlock" + SKILL = "Skill", + EXPERIENCE = "Experience", + TRADER_STANDING = "TraderStanding", + TRADER_UNLOCK = "TraderUnlock", + ITEM = "Item", + ASSORTMENT_UNLOCK = "AssortmentUnlock" } diff --git a/Live/CWX_MasterKey/server/types/models/enums/RaidMode.d.ts b/Live/CWX_MasterKey/server/types/models/enums/RaidMode.d.ts index c5a8cff..e20cf3f 100644 --- a/Live/CWX_MasterKey/server/types/models/enums/RaidMode.d.ts +++ b/Live/CWX_MasterKey/server/types/models/enums/RaidMode.d.ts @@ -1,5 +1,5 @@ export declare enum RaidMode { - Online = "Online", - Local = "Local", - Coop = "Coop" + ONLINE = "Online", + LOCAL = "Local", + COOP = "Coop" } diff --git a/Live/CWX_MasterKey/server/types/models/enums/WeaponTypes.d.ts b/Live/CWX_MasterKey/server/types/models/enums/WeaponTypes.d.ts new file mode 100644 index 0000000..867b052 --- /dev/null +++ b/Live/CWX_MasterKey/server/types/models/enums/WeaponTypes.d.ts @@ -0,0 +1,151 @@ +export declare enum Weapons127x55 { + ASH_12 = "5cadfbf7ae92152ac412eeef" +} +export declare enum Weapons86x70 { + MK_18 = "5fc22d7c187fea44d52eda44", + AXMC = "627e14b21713922ded6f2c15" +} +export declare enum Weapons9x39 { + AS_VAL = "57c44b372459772d2b39b8ce", + VSS_VINTOREZ = "57838ad32459774a17445cd2" +} +export declare enum Weapons762x54R { + SVDS = "5c46fbd72e2216398b5a8c9c", + MP_18 = "61f7c9e189e6fb1a5e3ea78d", + MOSIN_INFANTRY = "5bfd297f0db834001a669119", + MOSIN_SNIPER = "5ae08f0a5acfc408fb1398a1", + SV_98 = "55801eed4bdc2d89578b4588" +} +export declare enum Weapons762x51 { + VPO_101 = "5c501a4d2e221602b412b540", + DT_MDR_762 = "5dcbd56fdbd3d91b3e5468d5", + SA_58 = "5b0bbe4e5acfc40dc528a72d", + SCARH_BLACK = "6183afd850224f204c1da514", + SCARH_FDE = "6165ac306ef05c2ce828ef74", + HK_G28 = "6176aca650224f204c1da3fb", + M1A = "5aafa857e5b5b00018480968", + RFB = "5f2a9575926fd9352339381f", + RSASS = "5a367e5dc4a282000e49738f", + SR_25 = "5df8ce05b11454561e39243b", + DVL_10 = "588892092459774ac91d4b11", + M700 = "5bfea6e90db834001b7347f3", + T5000M = "5df24cf80dee1b22f862e9bc" +} +export declare enum Weapons366TKM { + VPO_209 = "59e6687d86f77411d949b251", + VPO_215 = "5de652c31b7e3716273428be" +} +export declare enum Weapons762x39 { + OP_SKS = "587e02ff24597743df3deaeb", + SKS = "574d967124597745970e7c94", + AK_103 = "5ac66d2e5acfc43b321d4b53", + AK_104 = "5ac66d725acfc43b321d4b60", + AKM = "59d6088586f774275f37482f", + AKMN = "5a0ec13bfcdbcb00165aa685", + AKMS = "59ff346386f77477562ff5e2", + AKMSN = "5abcbc27d8ce8700182eceeb", + MK47_MUTANT = "606587252535c57a13424cfd", + RD_704 = "628a60ae6b1d481ff772e9c8", + VPO_136 = "59e6152586f77473dc057aa1" +} +export declare enum Weapons762x35 { + MCX = "5fbcc1d9016cce60e8341ab3" +} +export declare enum Weapons556x45 { + ADAR_2_15 = "5c07c60e0db834002330051f", + AK_101 = "5ac66cb05acfc40198510a10", + AK_102 = "5ac66d015acfc400180ae6e4", + DT_MDR_556 = "5c488a752e221602b412af63", + HK_416A5 = "5bb2475ed4351e00853264e3", + HK_G36 = "623063e994fc3f7b302a9696", + M4A1 = "5447a9cd4bdc2dbd208b4567", + SCARL_BLACK = "6184055050224f204c1da540", + SCARL_FDE = "618428466ef05c2ce828f218", + TX15_DML = "5d43021ca4b9362eab4b5e25" +} +export declare enum Weapons545x39 { + AK_105 = "5ac66d9b5acfc4001633997a", + AK_74 = "5bf3e03b0db834001d2c4a9c", + AK_74M = "5ac4cd105acfc40016339859", + AK_74N = "5644bd2b4bdc2d3b4c8b4572", + AKS_74 = "5bf3e0490db83400196199af", + AKS_74N = "5ab8e9fcd8ce870019439434", + AKS_74U = "57dc2fa62459775949412633", + AKS_74UB = "5839a40f24597726f856b511", + AKS_74UN = "583990e32459771419544dd2", + SAG_AK = "628b5638ad252a16da6dd245", + SAG_AK_SHORT = "628b9c37a733087d0d7fe84b", + RPK_16 = "5beed0f50db834001c062b12" +} +export declare enum Weapons57x28FN { + FN_57_BLACK = "5d3eb3b0a4b93615055e84d2", + FN_57_FDE = "5d67abc1a4b93614ec50137f", + FN_P90 = "5cc82d76e24e8d00134b4b83" +} +export declare enum Weapons46x30HK { + MP7A1 = "5ba26383d4351e00334c93d9", + MP7A2 = "5bd70322209c4d00d7167b8f" +} +export declare enum Weapons1143x23 { + M1911A1 = "5e81c3cbac2bb513793cdc75", + M45A1 = "5f36a0e5fbf956000b716b65", + USP45 = "6193a720f8ee7e52e42109ed", + UMP45 = "5fc3e272f8b6a877a729eac5", + VECTOR45 = "5fb64bc92b1b027b1f50bcf2" +} +export declare enum Weapons9x33R { + CR_50DS = "61a4c8884f95bc3b2c5dc96f" +} +export declare enum Weapons9x21 { + SR_1MP = "59f98b4986f7746f546d2cef" +} +export declare enum Weapons9x19 { + GLOCK_17 = "5a7ae0c351dfba0017554310", + GLOCK_18C = "5b1fa9b25acfc40018633c01", + M9A3 = "5cadc190ae921500103bb3b6", + MP_443 = "576a581d2459771e7b1bc4f1", + P226R = "56d59856d2720bd8418b456a", + PL_15 = "602a9740da11d6478d5a06dc", + CR_200DS = "624c2e8614da335f1e034d8c", + MP5 = "5926bb2186f7744b1c6c6e60", + MP5K = "5d2f0d8048f0356c925bc3b0", + MP9 = "5e00903ae9dc277128008b87", + MP9_N = "5de7bd7bfd6b4e6e2276dc25", + MPX = "58948c8e86f77409493f7266", + PP_19_01 = "59984ab886f7743e98271174", + SAIGA_9 = "59f9cabd86f7743a10721f46", + STM_9 = "60339954d62c9b14ed777c06", + VECTOR_9MM = "5fc3f2d5900b1d5091531e57" +} +export declare enum Weapons9x18 { + APB = "5abccb7dd8ce87001773e277", + APS = "5a17f98cfcdbcb0980087290", + PB_SILENCED = "56e0598dd2720bb5668b45a6", + PM = "5448bd6b4bdc2dfc2f8b4569", + PM_T = "579204f224597773d619e051", + PP9_KLIN = "57f4c844245977379d5c14d1", + PP91_KEDR = "57d14d2524597714373db789", + PP91_KEDRB = "57f3c6bd24597738e730fa2f" +} +export declare enum Weapons762x25 { + TT = "571a12c42459771f627b58a0", + TT_GOLD = "5b3b713c5acfc4330140bd8d", + PPSH_41 = "5ea03f7400685063ec28bfa8" +} +export declare enum Weapons12Gauge { + M3_SUPER90 = "6259b864ebedf17603599e88", + M590A1 = "5e870397991fd70db46995c8", + M870 = "5a7828548dc32e5a9c28b516", + MP_133 = "54491c4f4bdc2db1078b4568", + MP_153 = "56dee2bdd2720bc8328b4567", + MP_155 = "606dae0ab0e443224b421bb7", + MP_43_1C = "5580223e4bdc2d1c128b457f", + MTS_255_12 = "60db29ce99594040e04c4a27", + SAIGA_12GA = "576165642459773c7a400233" +} +export declare enum Weapons20Gauge { + TOZ_106 = "5a38e6bac4a2826c6e06d79b" +} +export declare enum Weapons23x75 { + KS_23M = "5e848cc2988a8701445df1e8" +} diff --git a/Live/CWX_MasterKey/server/types/models/spt/bots/BotLootCache.d.ts b/Live/CWX_MasterKey/server/types/models/spt/bots/BotLootCache.d.ts index e185315..aedf7b0 100644 --- a/Live/CWX_MasterKey/server/types/models/spt/bots/BotLootCache.d.ts +++ b/Live/CWX_MasterKey/server/types/models/spt/bots/BotLootCache.d.ts @@ -11,13 +11,13 @@ export declare class BotLootCache { grenadeItems: ITemplateItem[]; } export declare enum LootCacheType { - Special = "Special", - Backpack = "Backpack", - Pocket = "Pocket", - Vest = "Vest", - Combined = "Combined", - HealingItems = "HealingItems", - DrugItems = "DrugItems", - StimItems = "StimItems", - GrenadeItems = "GrenadeItems" + SPECIAL = "Special", + BACKPACK = "Backpack", + POCKET = "Pocket", + VEST = "Vest", + COMBINED = "Combined", + HEALING_ITEMS = "HealingItems", + DRUG_ITEMS = "DrugItems", + STIM_ITEMS = "StimItems", + GRENADE_ITEMS = "GrenadeItems" } diff --git a/Live/CWX_MasterKey/server/types/models/spt/config/IAirdropConfig.d.ts b/Live/CWX_MasterKey/server/types/models/spt/config/IAirdropConfig.d.ts index f4aee89..3edcbdd 100644 --- a/Live/CWX_MasterKey/server/types/models/spt/config/IAirdropConfig.d.ts +++ b/Live/CWX_MasterKey/server/types/models/spt/config/IAirdropConfig.d.ts @@ -1,14 +1,14 @@ +import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IAirdropConfig extends IBaseConfig { kind: "aki-airdrop"; airdropChancePercent: AirdropChancePercent; - airdropMinOpenHeight: number; - airdropMaxOpenHeight: number; planeMinFlyHeight: number; planeMaxFlyHeight: number; planeVolume: number; airdropMinStartTimeSeconds: number; airdropMaxStartTimeSeconds: number; + loot: AirdropLoot; } export interface AirdropChancePercent { bigmap: number; @@ -18,3 +18,13 @@ export interface AirdropChancePercent { interchange: number; reserve: number; } +export interface AirdropLoot { + presetCount: MinMax; + itemCount: MinMax; + itemBlacklist: string[]; + itemTypeWhitelist: string[]; + /** key: item base type: value: max count */ + itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; +} diff --git a/Live/CWX_MasterKey/server/types/models/spt/config/IBotConfig.d.ts b/Live/CWX_MasterKey/server/types/models/spt/config/IBotConfig.d.ts index e171087..af8ceba 100644 --- a/Live/CWX_MasterKey/server/types/models/spt/config/IBotConfig.d.ts +++ b/Live/CWX_MasterKey/server/types/models/spt/config/IBotConfig.d.ts @@ -1,17 +1,31 @@ import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; +import { IBotDurability } from "./IBotDurability"; +import { IPmcConfig } from "./IPmcConfig"; export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; + /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** What bot types should be classified as bosses */ bosses: string[]; - durability: Durability; + /** Control weapon/armor durability min/max values for each bot type */ + durability: IBotDurability; + /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ lootNValue: LootNvalue; + /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; - pmc: PmcConfig; + /** PMC bot specific config settings */ + pmc: IPmcConfig; + /** Control how many items are allowed to spawn on a bot + * key: bottype, value: */ itemSpawnLimits: Record>; - equipment: Record; + /** Blacklist/whitelist items on a bot */ + equipment: Record; + /** Show a bots botType value after their name */ showTypeInNickname: boolean; - maxBotCap: number; + /** Max number of bots that can be spawned in a raid at any one time */ + maxBotCap: Record; + /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; } export interface PresetBatch { @@ -44,79 +58,23 @@ export interface PresetBatch { test: number; exUsec: number; } -export interface Durability { - default: DefaultDurability; - pmc: PmcDurability; - boss: BotDurability; - follower: BotDurability; - assault: BotDurability; - cursedassault: BotDurability; - marksman: BotDurability; - pmcbot: BotDurability; - exusec: BotDurability; - sectantpriest: BotDurability; - sectantwarrior: BotDurability; -} -export interface DefaultDurability { - armor: DefaultArmor; - weapon: WeaponDurability; -} -export interface DefaultArmor { - maxDelta: number; - minDelta: number; -} -export interface WeaponDurability { - lowestMax: number; - highestMax: number; - maxDelta: number; - minDelta: number; -} -export interface PmcDurability { - armor: PmcDurabilityArmor; - weapon: WeaponDurability; -} -export interface PmcDurabilityArmor { - lowestMaxPercent: number; - highestMaxPercent: number; - maxDelta: number; - minDelta: number; -} -export interface BotDurability { - armor: ArmorDurability; - weapon: WeaponDurability; -} -export interface ArmorDurability { - maxDelta: number; - minDelta: number; -} export interface LootNvalue { scav: number; pmc: number; } -export interface PmcConfig { - dynamicLoot: PmcDynamicLoot; - difficulty: string; - looseWeaponInBackpackChancePercent: number; - looseWeaponInBackpackLootMinMax: MinMax; - isUsec: number; - chanceSameSideIsHostilePercent: number; - usecType: string; - bearType: string; - maxBackpackLootTotalRub: number; - maxPocketLootTotalRub: number; - maxVestLootTotalRub: number; - convertIntoPmcChance: Record; - enemyTypes: string[]; -} -export interface PmcDynamicLoot { - whitelist: string[]; - blacklist: string[]; - moneyStackLimits: Record; -} -export interface Equipment { +export interface EquipmentFilters { + weaponModLimits: ModLimits; + randomisedWeaponModSlots?: string[]; + randomisedArmorSlots?: string[]; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; } +export interface ModLimits { + /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ + scopeLimit?: number; + /** How many lasers or lights are allowed on a weapon - hard coded to work with TACTICAL_COMBO, and FLASHLIGHT */ + lightLaserLimit?: number; +} export interface EquipmentFilterDetails { levelRange: MinMax; equipment: Record; diff --git a/Live/CWX_MasterKey/server/types/models/spt/config/IBotDurability.d.ts b/Live/CWX_MasterKey/server/types/models/spt/config/IBotDurability.d.ts new file mode 100644 index 0000000..38a47cc --- /dev/null +++ b/Live/CWX_MasterKey/server/types/models/spt/config/IBotDurability.d.ts @@ -0,0 +1,47 @@ +export interface IBotDurability { + default: DefaultDurability; + pmc: PmcDurability; + boss: BotDurability; + follower: BotDurability; + assault: BotDurability; + cursedassault: BotDurability; + marksman: BotDurability; + pmcbot: BotDurability; + exusec: BotDurability; + gifter: BotDurability; + sectantpriest: BotDurability; + sectantwarrior: BotDurability; +} +/** Durability values to be used when a more specific bot type cant be found */ +export interface DefaultDurability { + armor: DefaultArmor; + weapon: WeaponDurability; +} +export interface DefaultArmor { + maxDelta: number; + minDelta: number; +} +export interface WeaponDurability { + lowestMax: number; + highestMax: number; + maxDelta: number; + minDelta: number; +} +export interface PmcDurability { + armor: PmcDurabilityArmor; + weapon: WeaponDurability; +} +export interface PmcDurabilityArmor { + lowestMaxPercent: number; + highestMaxPercent: number; + maxDelta: number; + minDelta: number; +} +export interface BotDurability { + armor: ArmorDurability; + weapon: WeaponDurability; +} +export interface ArmorDurability { + maxDelta: number; + minDelta: number; +} diff --git a/Live/CWX_MasterKey/server/types/models/spt/config/IHideoutConfig.d.ts b/Live/CWX_MasterKey/server/types/models/spt/config/IHideoutConfig.d.ts index 36d6246..f232052 100644 --- a/Live/CWX_MasterKey/server/types/models/spt/config/IHideoutConfig.d.ts +++ b/Live/CWX_MasterKey/server/types/models/spt/config/IHideoutConfig.d.ts @@ -2,6 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; runIntervalSeconds: number; - fuelDrainRateMultipler: number; hoursForSkillCrafting: number; + generatorSpeedWithoutFuel: number; + generatorFuelFlowRate: number; + airFilterUnitFlowRate: number; + /** SEE HIDEOUTHELPER BEFORE CHANGING CONFIG */ + gpuBoostRate: number; } diff --git a/Live/CWX_MasterKey/server/types/models/spt/config/IItemConfig.d.ts b/Live/CWX_MasterKey/server/types/models/spt/config/IItemConfig.d.ts new file mode 100644 index 0000000..5ecccc2 --- /dev/null +++ b/Live/CWX_MasterKey/server/types/models/spt/config/IItemConfig.d.ts @@ -0,0 +1,5 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface IItemConfig extends IBaseConfig { + kind: "aki-item"; + blacklist: string[]; +} diff --git a/Live/CWX_MasterKey/server/types/models/spt/config/IPmcConfig.d.ts b/Live/CWX_MasterKey/server/types/models/spt/config/IPmcConfig.d.ts new file mode 100644 index 0000000..9db2ba1 --- /dev/null +++ b/Live/CWX_MasterKey/server/types/models/spt/config/IPmcConfig.d.ts @@ -0,0 +1,26 @@ +import { MinMax } from "../../common/MinMax"; +export interface IPmcConfig { + dynamicLoot: DynamicLoot; + useDifficultyOverride: boolean; + difficulty: string; + looseWeaponInBackpackChancePercent: number; + looseWeaponInBackpackLootMinMax: MinMax; + isUsec: number; + chanceSameSideIsHostilePercent: number; + /** key: location, value: type for usec/bear */ + pmcType: Record; + maxBackpackLootTotalRub: number; + maxPocketLootTotalRub: number; + maxVestLootTotalRub: number; + convertIntoPmcChance: Record; + enemyTypes: string[]; +} +export interface PmcTypes { + usec: string; + bear: string; +} +export interface DynamicLoot { + whitelist: string[]; + blacklist: string[]; + moneyStackLimits: Record; +} diff --git a/Live/CWX_MasterKey/server/types/models/spt/config/IQuestConfig.d.ts b/Live/CWX_MasterKey/server/types/models/spt/config/IQuestConfig.d.ts index be4a97b..45c9aae 100644 --- a/Live/CWX_MasterKey/server/types/models/spt/config/IQuestConfig.d.ts +++ b/Live/CWX_MasterKey/server/types/models/spt/config/IQuestConfig.d.ts @@ -4,6 +4,8 @@ export interface IQuestConfig extends IBaseConfig { kind: "aki-quest"; redeemTime: number; repeatableQuests: IRepeatableQuestConfig[]; + bearOnlyQuests: string[]; + usecOnlyQuests: string[]; } export interface IRepeatableQuestConfig { name: string; @@ -15,6 +17,10 @@ export interface IRepeatableQuestConfig { locations: Record; traderWhitelist: ITraderWhitelist[]; questConfig: IQuestConfig; + /** Item base types to block when generating rewards */ + rewardBaseTypeBlacklist: string[]; + /** Item tplIds to ignore when generating rewards */ + rewardBlacklist: string[]; } export interface IRewardScaling { levels: number[]; diff --git a/Live/CWX_MasterKey/server/types/models/spt/config/IRagfairConfig.d.ts b/Live/CWX_MasterKey/server/types/models/spt/config/IRagfairConfig.d.ts index c24e617..c1b8763 100644 --- a/Live/CWX_MasterKey/server/types/models/spt/config/IRagfairConfig.d.ts +++ b/Live/CWX_MasterKey/server/types/models/spt/config/IRagfairConfig.d.ts @@ -12,6 +12,7 @@ export interface Sell { chance: Chance; time: Time; reputation: Reputation; + simulatedSellHours: number; } export interface Chance { base: number; @@ -27,11 +28,18 @@ export interface Reputation { gain: number; loss: number; } +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Dynamic { + offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; price: MinMax; presetPrice: MinMax; + showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; condition: Condition; stackablePercent: MinMax; diff --git a/Live/CWX_MasterKey/server/types/models/spt/config/ITraderConfig.d.ts b/Live/CWX_MasterKey/server/types/models/spt/config/ITraderConfig.d.ts index c8e8044..6b1c1e3 100644 --- a/Live/CWX_MasterKey/server/types/models/spt/config/ITraderConfig.d.ts +++ b/Live/CWX_MasterKey/server/types/models/spt/config/ITraderConfig.d.ts @@ -12,8 +12,10 @@ export interface UpdateTime { seconds: number; } export interface FenceConfig { + partialRefreshTimeSeconds: number; + partialRefreshChangePercent: number; assortSize: number; - maxPresetsCount: number; + maxPresetsPercent: number; presetPriceMult: number; blacklist: string[]; } diff --git a/Live/CWX_MasterKey/server/types/models/spt/location/AirDropLootItem.d.ts b/Live/CWX_MasterKey/server/types/models/spt/location/AirDropLootItem.d.ts new file mode 100644 index 0000000..da791ff --- /dev/null +++ b/Live/CWX_MasterKey/server/types/models/spt/location/AirDropLootItem.d.ts @@ -0,0 +1,6 @@ +export declare class AirDropLootItem { + id: string; + tpl: string; + isPreset: boolean; + stackCount: number; +} diff --git a/Live/CWX_MasterKey/server/types/models/spt/logging/LogBackgroundColor.d.ts b/Live/CWX_MasterKey/server/types/models/spt/logging/LogBackgroundColor.d.ts index 87e08a9..1dd369b 100644 --- a/Live/CWX_MasterKey/server/types/models/spt/logging/LogBackgroundColor.d.ts +++ b/Live/CWX_MasterKey/server/types/models/spt/logging/LogBackgroundColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogBackgroundColor { - default = "", - black = "blackBG", - red = "redBG", - green = "greenBG", - yellow = "yellowBG", - blue = "blueBG", - magenta = "magentaBG", - cyan = "cyanBG", - white = "whiteBG" + DEFAULT = "", + BLACK = "blackBG", + RED = "redBG", + GREEN = "greenBG", + YELLOW = "yellowBG", + BLUE = "blueBG", + MAGENTA = "magentaBG", + CYAN = "cyanBG", + WHITE = "whiteBG" } diff --git a/Live/CWX_MasterKey/server/types/models/spt/logging/LogTextColor.d.ts b/Live/CWX_MasterKey/server/types/models/spt/logging/LogTextColor.d.ts index 7147ae3..6c7abf3 100644 --- a/Live/CWX_MasterKey/server/types/models/spt/logging/LogTextColor.d.ts +++ b/Live/CWX_MasterKey/server/types/models/spt/logging/LogTextColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogTextColor { - black = "black", - red = "red", - green = "green", - yellow = "yellow", - blue = "blue", - magenta = "magenta", - cyan = "cyan", - white = "white", - gray = "" + BLACK = "black", + RED = "red", + GREEN = "green", + YELLOW = "yellow", + BLUE = "blue", + MAGENTA = "magenta", + CYAN = "cyan", + WHITE = "white", + GRAY = "" } diff --git a/Live/CWX_MasterKey/server/types/models/spt/server/ILocaleBase.d.ts b/Live/CWX_MasterKey/server/types/models/spt/server/ILocaleBase.d.ts index 8887c06..6e20b89 100644 --- a/Live/CWX_MasterKey/server/types/models/spt/server/ILocaleBase.d.ts +++ b/Live/CWX_MasterKey/server/types/models/spt/server/ILocaleBase.d.ts @@ -13,10 +13,10 @@ export interface ILocaleGlobalBase { season: Record; customization: Record; repeatableQuest: Record; - templates: ILocaleTemplateBase; - locations: ILocaleLocationsBase; - banners: ILocaleBannersBase; - trading: ILocaleTradingBase; + templates: Record; + locations: Record; + banners: Record; + trading: Record; } export interface ILocaleQuest { name: string; @@ -31,23 +31,11 @@ export interface ILocaleQuest { export interface ILocalePreset { Name: string; } -export interface ILocaleTemplateBase { - templates: Record; -} -export interface ILocaleLocationsBase { - locations: Record; -} -export interface ILocaleBannersBase { - locations: Record; -} export interface ILocaleProps { Name: string; ShortName: string; Description: string; } -export interface ILocaleTradingBase { - locations: Record; -} export interface ILocaleTradingProps { FullName: string; FirstName: string; diff --git a/Live/CWX_MasterKey/server/types/models/spt/services/LootItem.d.ts b/Live/CWX_MasterKey/server/types/models/spt/services/LootItem.d.ts new file mode 100644 index 0000000..acb7606 --- /dev/null +++ b/Live/CWX_MasterKey/server/types/models/spt/services/LootItem.d.ts @@ -0,0 +1,6 @@ +export declare class LootItem { + id?: string; + tpl: string; + isPreset: boolean; + stackCount: number; +} diff --git a/Live/CWX_MasterKey/server/types/models/spt/services/LootRequest.d.ts b/Live/CWX_MasterKey/server/types/models/spt/services/LootRequest.d.ts new file mode 100644 index 0000000..1da8770 --- /dev/null +++ b/Live/CWX_MasterKey/server/types/models/spt/services/LootRequest.d.ts @@ -0,0 +1,11 @@ +import { MinMax } from "../../common/MinMax"; +export declare class LootRequest { + presetCount: MinMax; + itemCount: MinMax; + itemBlacklist: string[]; + itemTypeWhitelist: string[]; + /** key: item base type: value: max count */ + itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; +} diff --git a/Live/CWX_MasterKey/server/types/servers/DatabaseServer.d.ts b/Live/CWX_MasterKey/server/types/servers/DatabaseServer.d.ts index aa152d0..b3d29e9 100644 --- a/Live/CWX_MasterKey/server/types/servers/DatabaseServer.d.ts +++ b/Live/CWX_MasterKey/server/types/servers/DatabaseServer.d.ts @@ -2,5 +2,5 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; export declare class DatabaseServer { protected tableData: IDatabaseTables; getTables(): IDatabaseTables; - setTables(any: any): void; + setTables(tableData: IDatabaseTables): void; } diff --git a/Live/CWX_MasterKey/server/types/servers/RagfairServer.d.ts b/Live/CWX_MasterKey/server/types/servers/RagfairServer.d.ts index bc86cdb..c93864b 100644 --- a/Live/CWX_MasterKey/server/types/servers/RagfairServer.d.ts +++ b/Live/CWX_MasterKey/server/types/servers/RagfairServer.d.ts @@ -1,4 +1,6 @@ import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { TraderAssortHelper } from "../helpers/TraderAssortHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -12,11 +14,18 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected traderHelper: TraderHelper; + protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, configServer: ConfigServer); + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); load(): void; update(): void; + /** + * Get traders who need to be periodically refreshed + * @returns string array of traders + */ + protected getUpdateableTraders(): string[]; getAllCategories(): Record; getBespokeCategories(offers: IRagfairOffer[]): Record; /** diff --git a/Live/CWX_MasterKey/server/types/services/BotEquipmentFilterService.d.ts b/Live/CWX_MasterKey/server/types/services/BotEquipmentFilterService.d.ts index e49645b..632f961 100644 --- a/Live/CWX_MasterKey/server/types/services/BotEquipmentFilterService.d.ts +++ b/Live/CWX_MasterKey/server/types/services/BotEquipmentFilterService.d.ts @@ -1,12 +1,12 @@ import { IBotType } from "../models/eft/common/tables/IBotType"; -import { Equipment, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; protected configServer: ConfigServer; protected botConfig: IBotConfig; - protected botEquipmentFilterlists: Record; + protected botEquipmentFilterlists: Record; constructor(logger: ILogger, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig @@ -22,7 +22,7 @@ export declare class BotEquipmentFilterService { * @param playerLevel Level of the player * @returns EquipmentBlacklistDetails object */ - protected getBotEquipmentBlacklist(botRole: string, playerLevel: number): EquipmentFilterDetails; + getBotEquipmentBlacklist(botRole: string, playerLevel: number): EquipmentFilterDetails; /** * Get the whitelist for a specific bot type that's within the players level * @param botRole Bot type diff --git a/Live/CWX_MasterKey/server/types/services/BotGenerationCacheService.d.ts b/Live/CWX_MasterKey/server/types/services/BotGenerationCacheService.d.ts new file mode 100644 index 0000000..670c583 --- /dev/null +++ b/Live/CWX_MasterKey/server/types/services/BotGenerationCacheService.d.ts @@ -0,0 +1,52 @@ +import { BotHelper } from "../helpers/BotHelper"; +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotGenerationCacheService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected botHelper: BotHelper; + protected storedBots: IBotBase[]; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); + /** + * Store array of bots in cache, shuffle results before storage + * @param botsToStore + */ + storeBots(botsToStore: IBotBase[]): void; + /** + * Find and return a bot based on its role + * Remove bot from internal array so it can't be retreived again + * @param role role to retreive (assault/bossTagilla etc) + * @returns IBotBase object + */ + getBot(role: string): IBotBase[]; + /** + * Find a bot by its index from cache + * @param indexOfBotToReturn index to find bot by + * @returns bot profile + */ + protected getBotFromCache(indexOfBotToReturn: number): IBotBase; + /** + * Remove bot profile by index from cache + * @param indexOfBotToReturn Index of bot profile to remove + */ + protected removeBotFromCache(indexOfBotToReturn: number): void; + /** + * Get index of bot profile that matches criteria + * @param role role of bot we want + * @param getPmc is requested bot a pmc + * @returns index of found bot + */ + protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; + /** + * Remove all cached bot profiles + */ + clearStoredBots(): void; + /** + * Does cache have bots + * @returns true if empty + */ + cacheIsEmpty(): boolean; +} diff --git a/Live/CWX_MasterKey/server/types/services/BotLootCacheService.d.ts b/Live/CWX_MasterKey/server/types/services/BotLootCacheService.d.ts index cc71eee..00ffb9c 100644 --- a/Live/CWX_MasterKey/server/types/services/BotLootCacheService.d.ts +++ b/Live/CWX_MasterKey/server/types/services/BotLootCacheService.d.ts @@ -34,6 +34,17 @@ export declare class BotLootCacheService { * @param isPmc Is the bot a PMC (alteres what loot is cached) */ protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; + /** + * Sort a pool of item objects by its flea price + * @param poolToSort pool of items to sort + */ + protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; + /** + * Add unique items into combined pool + * @param combinedItemPool Pool of items to add to + * @param itemsToAdd items to add to combined pool if unique + */ + protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; /** * Ammo/grenades have this property * @param props diff --git a/Live/CWX_MasterKey/server/types/services/FenceService.d.ts b/Live/CWX_MasterKey/server/types/services/FenceService.d.ts index 79058c6..23fbf52 100644 --- a/Live/CWX_MasterKey/server/types/services/FenceService.d.ts +++ b/Live/CWX_MasterKey/server/types/services/FenceService.d.ts @@ -11,29 +11,109 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; +import { ItemFilterService } from "./ItemFilterService"; +/** + * Handle actions surrounding Fence + * e.g. generating or refreshing assorts / get next refresh time + */ export declare class FenceService { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); + protected nextMiniRefreshTimestamp: number; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; - getFenceAssorts(): ITraderAssort; - hasExpiredCache(refreshAssort: boolean): boolean; - generateFenceAssortCache(pmcData: IPmcData): void; /** - * Get the fence level the passed in profile has + * Get assorts player can purchase + * Adjust prices based on fence level of player + * @param pmcProfile Player profile + * @returns ITraderAssort + */ + getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Get fence assorts with no price adjustments based on fence rep + * @returns ITraderAssort + */ + getRawFenceAssorts(): ITraderAssort; + /** + * Does fence need to perform a partial refresh because its passed the refresh timer defined in trader.json + * @returns true if it needs a partial refresh + */ + needsPartialRefresh(): boolean; + /** + * Replace a percentage of fence assorts with freshly generated items + */ + performPartialRefresh(): void; + /** + * Increment fence next refresh timestamp by current timestamp + partialRefreshTimeSeconds from config + */ + protected incrementPartialRefreshTime(): void; + /** + * Compare the current fence offer count to what the config wants it to be, + * If value is lower add extra count to value to generate more items to fill gap + * @param existingItemCountToReplace count of items to generate + * @returns number of items to generate + */ + protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + /** + * Choose an item (not mod) at random and remove from assorts + */ + protected removeRandomItemFromAssorts(): void; + /** + * Get an integer rounded count of items to replace based on percentrage from traderConfig value + * @param totalItemCount total item count + * @returns rounded int of items to replace + */ + protected getCountOfItemsToReplace(totalItemCount: number): number; + /** + * Get the count of items fence offers + * @returns number + */ + getOfferCount(): number; + /** + * Create a trader assort for fence + */ + generateFenceAssortCache(): void; + /** + * Create skeleton to hold assort items + * @returns ITraderAssort object + */ + protected createBaseTraderAssortItem(): ITraderAssort; + /** + * Hydrate result parameter object with generated assorts + * @param assortCount Number of assorts to generate + * @param assorts object to add assorts to + */ + protected createAssorts(assortCount: number, assorts: ITraderAssort): void; + /** + * Get the next update timestamp for fence + * @returns future timestamp + */ + getNextFenceUpdateTimestamp(): number; + /** + * Get fence refresh time in seconds + */ + protected getFenceRefreshTime(): number; + /** + * Get fence level the passed in profile has * @param pmcData Player profile - * @returns FenceLevel + * @returns FenceLevel object */ getFenceInfo(pmcData: IPmcData): FenceLevel; + /** + * Remove an assort from fence by id + * @param assortIdToRemove assort id to remove from fence assorts + */ removeFenceOffer(assortIdToRemove: string): void; - updateFenceOffers(pmcData: IPmcData): void; } diff --git a/Live/CWX_MasterKey/server/types/services/InsuranceService.d.ts b/Live/CWX_MasterKey/server/types/services/InsuranceService.d.ts index 171bf10..6be8a2f 100644 --- a/Live/CWX_MasterKey/server/types/services/InsuranceService.d.ts +++ b/Live/CWX_MasterKey/server/types/services/InsuranceService.d.ts @@ -2,6 +2,7 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { InsuredItem } from "../models/eft/common/tables/IBotBase"; import { Item } from "../models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; @@ -44,8 +45,22 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; + /** + * Store lost gear post-raid inside profile + * @param pmcData player profile to store gear in + * @param offraidData post-raid request object + * @param preRaidGear gear player wore prior to raid + * @param sessionID Session id + */ storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string): void; storeInsuredItemsForReturn(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string): void; - protected addGearToSend(pmcData: IPmcData, insuredItem: any, actualItem: any, sessionID: string): any; + /** + * Add gear item to InsuredItems array in player profile + * @param pmcData profile to store item in + * @param insuredItem Item to store in profile + * @param actualItem item to store + * @param sessionID Session id + */ + protected addGearToSend(pmcData: IPmcData, insuredItem: InsuredItem, actualItem: Item, sessionID: string): void; getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; } diff --git a/Live/CWX_MasterKey/server/types/services/ItemFilterService.d.ts b/Live/CWX_MasterKey/server/types/services/ItemFilterService.d.ts new file mode 100644 index 0000000..c9c8ef3 --- /dev/null +++ b/Live/CWX_MasterKey/server/types/services/ItemFilterService.d.ts @@ -0,0 +1,24 @@ +import { IItemConfig } from "../models/spt/config/IItemConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +/** Centralise the handling of blacklisting items, uses blacklist found in config/item.json */ +export declare class ItemFilterService { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected blacklist: string[]; + protected itemConfig: IItemConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Check if the provided template id is blacklisted in config/item.json + * @param tpl template id + * @returns true if blacklisted + */ + isItemBlacklisted(tpl: string): boolean; + /** + * Return every template id blacklisted in config/item.json + * @returns string array of blacklisted tempalte ids + */ + getBlacklistedItems(): string[]; +} diff --git a/Live/CWX_MasterKey/server/types/services/PmcAiService.d.ts b/Live/CWX_MasterKey/server/types/services/PmcAiService.d.ts new file mode 100644 index 0000000..0690f1f --- /dev/null +++ b/Live/CWX_MasterKey/server/types/services/PmcAiService.d.ts @@ -0,0 +1,27 @@ +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +/** Storing/retreving pmcRoles set at the start of a raid - its done at that point as we know what location the player is heading to */ +export declare class PmcAiService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + protected usecRole: string; + protected bearRole: string; + constructor(logger: ILogger, configServer: ConfigServer); + /** + * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) + * @param pmcSide eft side (usec/bear) + * @returns pmc side as defined in config + */ + getPmcRole(pmcSide: "usec" | "bear" | string): string; + /** + * Set the roles for pmcs + * @param location map location to look up and use as pmc types + */ + setPmcRolesByLocation(location: string): void; + /** + * Clear the saved role from usec/bear PMCs + */ + clearPmcRoles(): void; +} diff --git a/Live/CWX_MasterKey/server/types/services/ProfileFixerService.d.ts b/Live/CWX_MasterKey/server/types/services/ProfileFixerService.d.ts index ed1dec7..9cb5a38 100644 --- a/Live/CWX_MasterKey/server/types/services/ProfileFixerService.d.ts +++ b/Live/CWX_MasterKey/server/types/services/ProfileFixerService.d.ts @@ -45,6 +45,11 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to find and remove slots from */ protected removeResourcesFromSlotsInHideoutWithoutLocationIndexValue(pmcProfile: IPmcData): void; + /** + * Hideout slots need to be in a specific order, locationIndex in ascending order + * @param pmcProfile profile to edit + */ + protected reorderHideoutAreasWithResouceInputs(pmcProfile: IPmcData): void; /** * add in objects equal to the number of slots * @param areaType area to check diff --git a/Live/CWX_MasterKey/server/types/services/ProfileSnapshotService.d.ts b/Live/CWX_MasterKey/server/types/services/ProfileSnapshotService.d.ts new file mode 100644 index 0000000..445ffd0 --- /dev/null +++ b/Live/CWX_MasterKey/server/types/services/ProfileSnapshotService.d.ts @@ -0,0 +1,30 @@ +import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { JsonUtil } from "../utils/JsonUtil"; +export declare class ProfileSnapshotService { + protected jsonUtil: JsonUtil; + protected storedProfileSnapshots: Record; + constructor(jsonUtil: JsonUtil); + /** + * Store a profile into an in-memory object + * @param sessionID session id - acts as the key + * @param profile - profile to save + */ + storeProfileSnapshot(sessionID: string, profile: IAkiProfile): void; + /** + * Retreve a stored profile + * @param sessionID key + * @returns A player profile object + */ + getProfileSnapshot(sessionID: string): IAkiProfile; + /** + * Does a profile exists against the provided key + * @param sessionID key + * @returns true if exists + */ + hasProfileSnapshot(sessionID: string): boolean; + /** + * Remove a stored profile by key + * @param sessionID key + */ + clearProfileSnapshot(sessionID: string): void; +} diff --git a/Live/CWX_MasterKey/server/types/services/RagfairOfferService.d.ts b/Live/CWX_MasterKey/server/types/services/RagfairOfferService.d.ts index 7398a8f..f9e3a34 100644 --- a/Live/CWX_MasterKey/server/types/services/RagfairOfferService.d.ts +++ b/Live/CWX_MasterKey/server/types/services/RagfairOfferService.d.ts @@ -24,7 +24,6 @@ export declare class RagfairOfferService { protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected toUpdate: Record; protected expiredOffers: Item[]; protected offers: IRagfairOffer[]; protected ragfairConfig: IRagfairConfig; @@ -38,8 +37,6 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; - setTraderUpdateStatus(traderId: string, shouldUpdate: boolean): void; - shouldTraderBeUpdated(traderID: string): boolean; getExpiredOfferCount(): number; /** * Get an array of expired items not yet processed into new offers @@ -53,12 +50,15 @@ export declare class RagfairOfferService { * @returns offer exists - true */ doesOfferExist(offerId: string): boolean; - getTraders(): Record; - flagTraderForUpdate(expiredOfferUserId: string): void; removeOfferById(offerId: string): void; removeOfferStack(offerID: string, amount: number): void; removeAllOffersByTrader(traderId: string): void; - addTradersToUpdateList(): void; + /** + * Do the trader offers on flea need to be refreshed + * @param traderID Trader to check + * @returns true if they do + */ + traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; /** diff --git a/Live/CWX_MasterKey/server/types/services/RagfairPriceService.d.ts b/Live/CWX_MasterKey/server/types/services/RagfairPriceService.d.ts index 679fe1d..466c9e3 100644 --- a/Live/CWX_MasterKey/server/types/services/RagfairPriceService.d.ts +++ b/Live/CWX_MasterKey/server/types/services/RagfairPriceService.d.ts @@ -27,6 +27,20 @@ export declare class RagfairPriceService { getDynamicPrice(itemTpl: string): number; getAllFleaPrices(): Record; getFleaPriceForItem(tplId: string): number; + /** + * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * @param itemPrice price of item + * @param itemTpl item template Id being checked + * @returns adjusted price value in roubles + */ + protected adjustPriceIfBelowHandbook(itemPrice: number, itemTpl: string): number; + /** + * Get the percentage difference between two values + * @param a numerical value a + * @param b numerical value b + * @returns different in percent + */ + protected getPriceDifference(a: number, b: number): number; getStaticPriceForItem(tplId: string): number; getBarterPrice(barterScheme: IBarterScheme[]): number; getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; diff --git a/Live/CWX_MasterKey/server/types/services/RepairService.d.ts b/Live/CWX_MasterKey/server/types/services/RepairService.d.ts new file mode 100644 index 0000000..3e6077c --- /dev/null +++ b/Live/CWX_MasterKey/server/types/services/RepairService.d.ts @@ -0,0 +1,75 @@ +import { QuestHelper } from "../helpers/QuestHelper"; +import { RepairHelper } from "../helpers/RepairHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { RepairKitsInfo } from "../models/eft/repair/IRepairActionDataRequest"; +import { RepairItem } from "../models/eft/repair/ITraderRepairActionDataRequest"; +import { IRepairConfig } from "../models/spt/config/IRepairConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ItemEventRouter } from "../routers/ItemEventRouter"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { PaymentService } from "./PaymentService"; +export declare class RepairService { + protected logger: ILogger; + protected itemEventRouter: ItemEventRouter; + protected databaseServer: DatabaseServer; + protected questHelper: QuestHelper; + protected traderHelper: TraderHelper; + protected paymentService: PaymentService; + protected repairHelper: RepairHelper; + protected configServer: ConfigServer; + repairConfig: IRepairConfig; + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + /** + * Use trader to repair an items durability + * @param sessionID Session id + * @param pmcData profile to find item to repair in + * @param repairItemDetails details of the item to repair + * @param traderId Trader being used to repair item + * @returns RepairDetails object + */ + repairItemByTrader(sessionID: string, pmcData: IPmcData, repairItemDetails: RepairItem, traderId: string): RepairDetails; + /** + * + * @param sessionID Session id + * @param pmcData profile to take money from + * @param repairedItemId Repaired item id + * @param repairCost Cost to repair item in roubles + * @param traderId Id of the trader who repaired the item / who is paid + * @param output + */ + payForRepair(sessionID: string, pmcData: IPmcData, repairedItemId: string, repairCost: number, traderId: string, output: IItemEventRouterResponse): void; + /** + * Add skill points to profile after repairing an item + * @param sessionId Session id + * @param repairDetails details of item repaired, cost/item + * @param pmcData Profile to add points to + * @param output IItemEventRouterResponse + */ + addRepairSkillPoints(sessionId: string, repairDetails: RepairDetails, pmcData: IPmcData, output: IItemEventRouterResponse): void; + /** + * + * @param sessionId Session id + * @param pmcData Profile to update repaired item in + * @param repairKits Array of Repair kits to use + * @param itemToRepairId Item id to repair + * @param output IItemEventRouterResponse + * @returns Details of repair, item/price + */ + repairItemByKit(sessionId: string, pmcData: IPmcData, repairKits: RepairKitsInfo[], itemToRepairId: string, output: IItemEventRouterResponse): RepairDetails; + /** + * Update repair kits Resource object if it doesn't exist + * @param repairKitDetails Repair kit details from db + * @param repairKitInInventory Repair kit to update + */ + protected addMaxResourceToKitIfMissing(repairKitDetails: ITemplateItem, repairKitInInventory: Item): void; +} +export declare class RepairDetails { + repairCost?: number; + repairedItem: Item; + repairedItemIsArmor: boolean; +} diff --git a/Live/CWX_MasterKey/server/types/services/TraderAssortService.d.ts b/Live/CWX_MasterKey/server/types/services/TraderAssortService.d.ts index 5ba2d05..03b4e12 100644 --- a/Live/CWX_MasterKey/server/types/services/TraderAssortService.d.ts +++ b/Live/CWX_MasterKey/server/types/services/TraderAssortService.d.ts @@ -2,5 +2,10 @@ import { ITraderAssort } from "../models/eft/common/tables/ITrader"; export declare class TraderAssortService { protected pristineTraderAssorts: Record; getPristineTraderAssort(traderId: string): ITraderAssort; + /** + * Store trader assorts inside a class property + * @param traderId Traderid to store assorts against + * @param assort Assorts to store + */ setPristineTraderAssort(traderId: string, assort: ITraderAssort): void; } diff --git a/Live/CWX_MasterKey/server/types/utils/HashUtil.d.ts b/Live/CWX_MasterKey/server/types/utils/HashUtil.d.ts index bacbf2a..a8500e1 100644 --- a/Live/CWX_MasterKey/server/types/utils/HashUtil.d.ts +++ b/Live/CWX_MasterKey/server/types/utils/HashUtil.d.ts @@ -4,8 +4,18 @@ import { TimeUtil } from "./TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; constructor(timeUtil: TimeUtil); + /** + * Create a 24 character id using the sha256 algorithm + current timestamp + * @returns 24 character hash + */ generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + /** + * Create a hash for the data parameter + * @param algorithm algorithm to use to hash + * @param data data to be hashed + * @returns hash value + */ generateHashForData(algorithm: string, data: crypto.BinaryLike): string; } diff --git a/Live/CWX_MasterKey/server/types/utils/RandomUtil.d.ts b/Live/CWX_MasterKey/server/types/utils/RandomUtil.d.ts index c24dd60..633e472 100644 --- a/Live/CWX_MasterKey/server/types/utils/RandomUtil.d.ts +++ b/Live/CWX_MasterKey/server/types/utils/RandomUtil.d.ts @@ -136,7 +136,7 @@ export declare class RandomUtil { * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with ot without replacement from the input array + * @param {boolean} replacement Draw with or without replacement from the input array * @return {array} Array consisting of N random elements */ drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; @@ -150,4 +150,10 @@ export declare class RandomUtil { */ drawRandomFromDict(dict: any, count?: number, replacement?: boolean): any[]; getBiasedRandomNumber(min: number, max: number, shift: number, n: number): number; + /** + * Fisher-Yates shuffle an array + * @param array Array to shuffle + * @returns Shuffled array + */ + shuffle(array: Array): Array; } diff --git a/Live/CWX_MasterKey/server/types/utils/TimeUtil.d.ts b/Live/CWX_MasterKey/server/types/utils/TimeUtil.d.ts index eed4e6d..1367e26 100644 --- a/Live/CWX_MasterKey/server/types/utils/TimeUtil.d.ts +++ b/Live/CWX_MasterKey/server/types/utils/TimeUtil.d.ts @@ -1,9 +1,16 @@ +/** + * Utility class to handle time related problems + */ export declare class TimeUtil { static readonly oneHourAsSeconds = 3600; formatTime(date: Date): string; formatDate(date: Date): string; getDate(): string; getTime(): string; + /** + * Get timestamp in seconds + * @returns + */ getTimestamp(): number; /** * mail in eft requires time be in a specific format @@ -15,4 +22,10 @@ export declare class TimeUtil { * @returns current date in format: 00.00.0000 (dd.mm.yyyy) */ getDateMailFormat(): string; + /** + * Convert hours into seconds + * @param hours hours to convert to seconds + * @returns number + */ + getHoursAsSeconds(hours: number): number; } diff --git a/Live/CWX_WeatherPatcher/CWX_WeatherPatch.csproj b/Live/CWX_WeatherPatcher/CWX_WeatherPatch.csproj index 018490e..b7c60fd 100644 --- a/Live/CWX_WeatherPatcher/CWX_WeatherPatch.csproj +++ b/Live/CWX_WeatherPatcher/CWX_WeatherPatch.csproj @@ -2,7 +2,7 @@ net472 - 2.3.0 + 2.4.4 CWX-WeatherPatcher diff --git a/Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.3/BepInEx/plugins/CWX-WeatherPatcher.dll b/Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.4/BepInEx/plugins/CWX-WeatherPatcher.dll similarity index 88% rename from Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.3/BepInEx/plugins/CWX-WeatherPatcher.dll rename to Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.4/BepInEx/plugins/CWX-WeatherPatcher.dll index cc1bffb..4e5b76b 100644 Binary files a/Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.3/BepInEx/plugins/CWX-WeatherPatcher.dll and b/Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.4/BepInEx/plugins/CWX-WeatherPatcher.dll differ diff --git a/Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.3/user/mods/CWX-WeatherPatcher 2.4.3/LICENSE.txt b/Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.4/user/mods/CWX-WeatherPatcher 2.4.4/LICENSE.txt similarity index 100% rename from Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.3/user/mods/CWX-WeatherPatcher 2.4.3/LICENSE.txt rename to Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.4/user/mods/CWX-WeatherPatcher 2.4.4/LICENSE.txt diff --git a/Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.3/user/mods/CWX-WeatherPatcher 2.4.3/package.json b/Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.4/user/mods/CWX-WeatherPatcher 2.4.4/package.json similarity index 95% rename from Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.3/user/mods/CWX-WeatherPatcher 2.4.3/package.json rename to Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.4/user/mods/CWX-WeatherPatcher 2.4.4/package.json index 96ceeed..0a35d7e 100644 --- a/Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.3/user/mods/CWX-WeatherPatcher 2.4.3/package.json +++ b/Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.4/user/mods/CWX-WeatherPatcher 2.4.4/package.json @@ -1,10 +1,10 @@ { "name": "WeatherPatcher", "author": "CWX", - "version": "2.4.3", + "version": "2.4.4", "license": "NCSA", "main": "src/mod.js", - "akiVersion": "3.2.2", + "akiVersion": "3.2.3", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" ./**/*.* ./dist", diff --git a/Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.3/user/mods/CWX-WeatherPatcher 2.4.3/src/mod.ts b/Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.4/user/mods/CWX-WeatherPatcher 2.4.4/src/mod.ts similarity index 100% rename from Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.3/user/mods/CWX-WeatherPatcher 2.4.3/src/mod.ts rename to Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.4/user/mods/CWX-WeatherPatcher 2.4.4/src/mod.ts diff --git a/Live/CWX_WeatherPatcher/GClassPatch.cs b/Live/CWX_WeatherPatcher/GClassPatch.cs index 1ef309e..fd8d192 100644 --- a/Live/CWX_WeatherPatcher/GClassPatch.cs +++ b/Live/CWX_WeatherPatcher/GClassPatch.cs @@ -4,7 +4,7 @@ using EFT; namespace CWX_WeatherPatcher { - class GClassPatch : ModulePatch // MAKES CHANGES TO GClass1694 SMETHOD_0 + class GClassPatch : ModulePatch // MAKES CHANGES TO WeatherClass SMETHOD_0 { protected override MethodBase GetTargetMethod() { diff --git a/Live/CWX_WeatherPatcher/LevelSettingsPatch.cs b/Live/CWX_WeatherPatcher/LevelSettingsPatch.cs index 7eace25..39dfb89 100644 --- a/Live/CWX_WeatherPatcher/LevelSettingsPatch.cs +++ b/Live/CWX_WeatherPatcher/LevelSettingsPatch.cs @@ -3,7 +3,7 @@ using System.Reflection; namespace CWX_WeatherPatcher { - class LevelSettingsPatch : ModulePatch // MAKES CHANGES TO LEVELSETTINGS + class LevelSettingsPatch : ModulePatch // MAKES CHANGES TO LevelSettings { protected override MethodBase GetTargetMethod() { diff --git a/Live/CWX_WeatherPatcher/Program.cs b/Live/CWX_WeatherPatcher/Program.cs index 9b1bc02..547d36e 100644 --- a/Live/CWX_WeatherPatcher/Program.cs +++ b/Live/CWX_WeatherPatcher/Program.cs @@ -4,7 +4,7 @@ using EFT.Weather; namespace CWX_WeatherPatcher { - [BepInPlugin("com.CWX.WeatherPatcher", "CWX-WeatherPatcher", "2.4.0")] + [BepInPlugin("com.CWX.WeatherPatcher", "CWX-WeatherPatcher", "2.4.4")] public class Plugin : BaseUnityPlugin { private void Awake() diff --git a/Live/CWX_WeatherPatcher/README.md b/Live/CWX_WeatherPatcher/README.md index dca8c04..d0fd4d2 100644 --- a/Live/CWX_WeatherPatcher/README.md +++ b/Live/CWX_WeatherPatcher/README.md @@ -1,5 +1,5 @@ # WeatherPatcher ## CWX-WEATHERPATCHER for EFT - SPT-AKI -### CURRENT AKI VERSION: 2.3.0 -### GAMEVERSION: 0.12.12.15.16909 +### CURRENT AKI VERSION: 3.2.3 +### GAMEVERSION: 0.12.12.31.19428 ### USING BEPINEX \ No newline at end of file diff --git a/Live/CWX_WeatherPatcher/server/dist/package.json b/Live/CWX_WeatherPatcher/server/dist/package.json index 96ceeed..0a35d7e 100644 --- a/Live/CWX_WeatherPatcher/server/dist/package.json +++ b/Live/CWX_WeatherPatcher/server/dist/package.json @@ -1,10 +1,10 @@ { "name": "WeatherPatcher", "author": "CWX", - "version": "2.4.3", + "version": "2.4.4", "license": "NCSA", "main": "src/mod.js", - "akiVersion": "3.2.2", + "akiVersion": "3.2.3", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" ./**/*.* ./dist", diff --git a/Live/CWX_WeatherPatcher/server/dist/types/callbacks/InsuranceCallbacks.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/callbacks/InsuranceCallbacks.d.ts index 6819960..8835ba2 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/callbacks/InsuranceCallbacks.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/callbacks/InsuranceCallbacks.d.ts @@ -1,5 +1,5 @@ import { InsuranceController } from "../controllers/InsuranceController"; -import { OnLoadOnUpdate } from "../di/OnLoadOnUpdate"; +import { OnUpdate } from "../di/OnUpdate"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData"; @@ -10,14 +10,13 @@ import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { InsuranceService } from "../services/InsuranceService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -export declare class InsuranceCallbacks extends OnLoadOnUpdate { +export declare class InsuranceCallbacks extends OnUpdate { protected insuranceController: InsuranceController; protected insuranceService: InsuranceService; protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); - onLoad(): void; getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; diff --git a/Live/CWX_WeatherPatcher/server/dist/types/callbacks/LocationCallbacks.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/callbacks/LocationCallbacks.d.ts index cc69369..6e0b538 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/callbacks/LocationCallbacks.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/callbacks/LocationCallbacks.d.ts @@ -11,4 +11,5 @@ export declare class LocationCallbacks { constructor(httpResponse: HttpResponseUtil, locationController: LocationController); getLocationData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocation(url: string, info: IGetLocationRequestData, sessionID: string): IGetBodyResponseData; + getAirdropLoot(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/callbacks/ProfileCallbacks.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/callbacks/ProfileCallbacks.d.ts index 6a86fc0..183bb0a 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/callbacks/ProfileCallbacks.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/callbacks/ProfileCallbacks.d.ts @@ -1,5 +1,6 @@ import { ProfileController } from "../controllers/ProfileController"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IGetMiniProfileRequestData } from "../models/eft/launcher/IGetMiniProfileRequestData"; @@ -12,20 +13,51 @@ import { ISearchFriendResponse } from "../models/eft/profile/ISearchFriendRespon import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** Handle profile related client events */ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); createProfile(url: string, info: IProfileCreateRequestData, sessionID: string): IGetBodyResponseData; - getProfileData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - regenerateScav(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Get the complete player profile (scav + pmc character) + * @param url + * @param info Empty + * @param sessionID Session id + * @returns Profile object + */ + getProfileData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle the creation of a scav profile for player + * Occurs post-raid and when profile first created immediately after character details are confirmed by player + * @param url + * @param info empty + * @param sessionID Session id + * @returns Profile object + */ + regenerateScav(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/profile/voice/change event + * @param url + * @param info Change voice request object + * @param sessionID Session id + * @returns Client response + */ changeVoice(url: string, info: IProfileChangeVoiceRequestData, sessionID: string): INullResponseData; + /** + * Handle client/game/profile/nickname/change event + * Client allows player to adjust their profile name + * @param url + * @param info Change nickname request object + * @param sessionID Session id + * @returns client response + */ changeNickname(url: string, info: IProfileChangeNicknameRequestData, sessionID: string): IGetBodyResponseData; validateNickname(url: string, info: IValidateNicknameRequestData, sessionID: string): IGetBodyResponseData; getReservedNickname(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** - * Called when creating a character, when you choose a character face/voice + * Called when creating a character when choosing a character face/voice * @param url * @param info response (empty) * @param sessionID diff --git a/Live/CWX_WeatherPatcher/server/dist/types/callbacks/RagfairCallbacks.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/callbacks/RagfairCallbacks.d.ts index 3a405c9..c609f2f 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/callbacks/RagfairCallbacks.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/callbacks/RagfairCallbacks.d.ts @@ -19,6 +19,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; +/** + * Handle ragfair related callback events + */ export declare class RagfairCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; protected logger: ILogger; diff --git a/Live/CWX_WeatherPatcher/server/dist/types/callbacks/RepairCallbacks.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/callbacks/RepairCallbacks.d.ts index 63733fa..14edeeb 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/callbacks/RepairCallbacks.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/callbacks/RepairCallbacks.d.ts @@ -6,6 +6,20 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa export declare class RepairCallbacks { protected repairController: RepairController; constructor(repairController: RepairController); + /** + * use trader to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + /** + * Use repair kit to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ repair(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/callbacks/TraderCallbacks.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/callbacks/TraderCallbacks.d.ts index 128d9b2..e4fd099 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/callbacks/TraderCallbacks.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/callbacks/TraderCallbacks.d.ts @@ -9,10 +9,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); onLoad(): void; + onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - onUpdate(): boolean; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/context/ContextVariable.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/context/ContextVariable.d.ts index e438947..0fe0a63 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/context/ContextVariable.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/context/ContextVariable.d.ts @@ -4,7 +4,7 @@ export declare class ContextVariable { private timestamp; private type; constructor(value: any, type: ContextVariableType); - getValue(): any; + getValue(): T; getTimestamp(): Date; getType(): ContextVariableType; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/controllers/BotController.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/controllers/BotController.d.ts index 5e6f05d..a5111d5 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/controllers/BotController.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/controllers/BotController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotHelper } from "../helpers/BotHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; @@ -5,15 +6,22 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { IBotCore } from "../models/eft/common/tables/IBotCore"; import { Difficulty } from "../models/eft/common/tables/IBotType"; import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; +import { PmcAiService } from "../services/PmcAiService"; export declare class BotController { + protected logger: ILogger; protected databaseServer: DatabaseServer; protected botGenerator: BotGenerator; protected botHelper: BotHelper; + protected pmcAiService: PmcAiService; + protected botGenerationCacheService: BotGenerationCacheService; protected configServer: ConfigServer; + protected applicationContext: ApplicationContext; protected botConfig: IBotConfig; - constructor(databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -29,7 +37,18 @@ export declare class BotController { * @returns Difficulty object */ getBotDifficulty(type: string, difficulty: string): Difficulty; - protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string): Difficulty; + protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Generate bot profiles and store in cache + * @param sessionId Session id + * @param info bot generation request info + * @returns IBotBase array + */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the max number of bots allowed on a map + * Looks up location player is entering when getting cap value + * @returns cap number + */ getBotCap(): number; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/controllers/GameController.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/controllers/GameController.d.ts index 85ec418..2d00898 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/controllers/GameController.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/controllers/GameController.d.ts @@ -7,11 +7,13 @@ import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; protected localeService: LocaleService; @@ -20,9 +22,14 @@ export declare class GameController { protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + /** + * Make non-trigger-spawned raiders spawn earlier + always + */ + protected adjustLabsRaiderSpawnRate(): void; protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; + getValidGameVersion(): any; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/controllers/HideoutController.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/controllers/HideoutController.d.ts index 3eefe1a..dcd8894 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/controllers/HideoutController.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/controllers/HideoutController.d.ts @@ -28,6 +28,7 @@ import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,9 +46,10 @@ export declare class HideoutController { protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/Live/CWX_WeatherPatcher/server/dist/types/controllers/InraidController.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/controllers/InraidController.d.ts index b899e7d..102a2fb 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/controllers/InraidController.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/controllers/InraidController.d.ts @@ -5,9 +5,11 @@ import { ItemHelper } from "../helpers/ItemHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; @@ -15,6 +17,7 @@ import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class InraidController { + protected logger: ILogger; protected saveServer: SaveServer; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; @@ -29,16 +32,40 @@ export declare class InraidController { protected inRaidHelper: InRaidHelper; protected configServer: ConfigServer; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Handle updating the profile post-pmc raid + * @param sessionID session id + * @param offraidData post-raid data of raid + */ + protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Reduce body part hp to % of max + * @param pmcData profile to edit + * @param multipler multipler to apply to max health + */ + protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + /** + * Handle updating the profile post-pscav raid + * @param sessionID session id + * @param offraidData post-raid data of raid + */ + protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Is the player dead after a raid - dead is anything other than "survived" / "runner" + * @param statusOnExit exit value from offraidData object + * @returns true if dead + */ + protected isPlayerDead(statusOnExit: string): boolean; /** * Mark inventory items as FiR if player survived raid, otherwise remove FiR from them * @param offraidData Save Progress Request * @param pmcData player profile * @param isPlayerScav Was the player a pScav */ - private markOrRemoveFoundInRaidItems; - private handlePostRaidPlayerScavProcess; - private handlePostRaidPlayerScavKarmaChanges; + protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/controllers/InventoryController.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/controllers/InventoryController.d.ts index f57f731..f564919 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/controllers/InventoryController.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/controllers/InventoryController.d.ts @@ -92,7 +92,11 @@ export declare class InventoryController { */ toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; /** - * Handles Tagging of items (primary Containers). + * Add a tag to an inventory item + * @param pmcData profile with item to add tag to + * @param body tag request data + * @param sessionID session id + * @returns client response object */ tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/Live/CWX_WeatherPatcher/server/dist/types/controllers/LocationController.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/controllers/LocationController.d.ts index 90b6d7a..9db3205 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/controllers/LocationController.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/controllers/LocationController.d.ts @@ -1,18 +1,33 @@ import { LocationGenerator } from "../generators/LocationGenerator"; +import { LootGenerator } from "../generators/LootGenerator"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; +import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; +import { LootItem } from "../models/spt/services/LootItem"; import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class LocationController { protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected logger: ILogger; protected locationGenerator: LocationGenerator; + protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; - constructor(jsonUtil: JsonUtil, logger: ILogger, locationGenerator: LocationGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil); + protected configServer: ConfigServer; + protected airdropConfig: IAirdropConfig; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; generateAll(): ILocationsGenerateAllResponse; + /** + * Get loot for an airdop container + * Generates it randomly based on config/airdrop.json values + * @returns Array of LootItem + */ + getAirdropLoot(): LootItem[]; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/controllers/MatchController.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/controllers/MatchController.d.ts index 71cb7d3..07f6a89 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/controllers/MatchController.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/controllers/MatchController.d.ts @@ -9,23 +9,33 @@ import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestDa import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; +import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { PmcAiService } from "../services/PmcAiService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { + protected logger: ILogger; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected matchLocationService: MatchLocationService; protected traderHelper: TraderHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; + protected profileSnapshotService: ProfileSnapshotService; + protected pmcAiService: PmcAiService; + protected botGenerationCacheService: BotGenerationCacheService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + protected botConfig: IBotConfig; + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/Live/CWX_WeatherPatcher/server/dist/types/controllers/QuestController.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/controllers/QuestController.d.ts index 2cbccfb..282f50e 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/controllers/QuestController.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/controllers/QuestController.d.ts @@ -39,16 +39,31 @@ export declare class QuestController { * @returns array of IQuest */ getClientQuests(sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param side player side (usec/bear) + * @param questId questId to check + */ + protected questIsForOtherSide(side: string, questId: string): boolean; + /** + * Handle the client accepting a quest and starting it + * Send starting rewards if any to player and + * Send start notification if any to player + * @param pmcData Profile to update + * @param acceptedQuest Quest accepted + * @param sessionID Session id + * @returns client response + */ acceptQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; acceptRepeatableQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; /** - * Remove completed quest from profile + * Update completed quest in profile * Add newly unlocked quests to profile * Also recalculate thier level due to exp rewards * @param pmcData Player profile - * @param body completed quest request - * @param sessionID session id - * @returns ItemEvent response + * @param body Completed quest request + * @param sessionID Session id + * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -67,10 +82,20 @@ export declare class QuestController { protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the quests provided + * Update quest in profile, otherwise add fresh quest object with failed status * @param sessionID session id * @param pmcData player profile * @param questsToFail quests to fail */ protected failQuests(sessionID: string, pmcData: IPmcData, questsToFail: IQuest[]): void; handoverQuest(pmcData: IPmcData, body: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Increment a backend counter stored value by an amount, + * Create counter if it does not exist + * @param pmcData Profile to find backend counter in + * @param conditionId backend counter id to update + * @param questId quest id counter is associated with + * @param counterValue value to increment the backend counter with + */ + protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/controllers/RagfairController.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/controllers/RagfairController.d.ts index c4ffc15..06af740 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/controllers/RagfairController.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/controllers/RagfairController.d.ts @@ -9,6 +9,7 @@ import { RagfairOfferHelper } from "../helpers/RagfairOfferHelper"; import { RagfairSellHelper } from "../helpers/RagfairSellHelper"; import { RagfairSortHelper } from "../helpers/RagfairSortHelper"; import { RagfairTaxHelper } from "../helpers/RagfairTaxHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; @@ -33,6 +34,9 @@ import { RagfairPriceService } from "../services/RagfairPriceService"; import { RagfairRequiredItemsService } from "../services/RagfairRequiredItemsService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** + * Handle RagfairCallback events + */ export declare class RagfairController { protected logger: ILogger; protected timeUtil: TimeUtil; @@ -52,14 +56,20 @@ export declare class RagfairController { protected handbookHelper: HandbookHelper; protected paymentHelper: PaymentHelper; protected inventoryHelper: InventoryHelper; + protected traderHelper: TraderHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected ragfairOfferGenerator: RagfairOfferGenerator; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + /** + * Update a trader flea offer with buy restrictions stored in the traders assort + * @param offer flea offer to update + */ + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer): void; protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; diff --git a/Live/CWX_WeatherPatcher/server/dist/types/controllers/RepairController.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/controllers/RepairController.d.ts index 0e78ef6..ae54a53 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/controllers/RepairController.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/controllers/RepairController.d.ts @@ -8,9 +8,9 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa import { IRepairConfig } from "../models/spt/config/IRepairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; -import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { PaymentService } from "../services/PaymentService"; +import { RepairService } from "../services/RepairService"; export declare class RepairController { protected logger: ILogger; protected itemEventRouter: ItemEventRouter; @@ -19,23 +19,23 @@ export declare class RepairController { protected traderHelper: TraderHelper; protected paymentService: PaymentService; protected repairHelper: RepairHelper; - protected configServer: ConfigServer; + protected repairService: RepairService; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); /** * Repair with trader - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + traderRepair(sessionID: string, body: ITraderRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; /** * Repair with repair kit - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - repairWithKit(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + repairWithKit(sessionID: string, body: IRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/controllers/RepeatableQuestController.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/controllers/RepeatableQuestController.d.ts index 98d05dd..4c31a3d 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/controllers/RepeatableQuestController.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/controllers/RepeatableQuestController.d.ts @@ -7,6 +7,7 @@ import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; import { TraderInfo } from "../models/eft/common/tables/IBotBase"; import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; import { ELocationName } from "../models/enums/ELocationName"; @@ -15,6 +16,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -64,9 +66,10 @@ export declare class RepeatableQuestController { protected itemEventRouter: ItemEventRouter; protected paymentService: PaymentService; protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. @@ -217,4 +220,16 @@ export declare class RepeatableQuestController { debugLogRepeatableQuestIds(pmcData: IPmcData): void; probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; changeRepeatableQuest(pmcDataIn: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {*} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/controllers/TraderController.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/controllers/TraderController.d.ts index 7bab158..b79f55e 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/controllers/TraderController.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/controllers/TraderController.d.ts @@ -4,6 +4,7 @@ import { TraderHelper } from "../helpers/TraderHelper"; import { IBarterScheme, ITraderAssort, ITraderBase } from "../models/eft/common/tables/ITrader"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -15,12 +16,29 @@ export declare class TraderController { protected traderHelper: TraderHelper; protected timeUtil: TimeUtil; protected traderAssortService: TraderAssortService; + protected fenceService: FenceService; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, fenceService: FenceService, jsonUtil: JsonUtil); + /** + * Runs when onLoad event is fired + * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Store timestamp of next assort refresh in nextResupply property of traders .base object + */ load(): void; - getTrader(traderID: string, sessionID: string): ITraderBase; + /** + * Runs when onUpdate is fired + * If current time is > nextResupply(expire) time of trader, refresh traders assorts and + * Fence is handled slightly differently + * @returns has run + */ + update(): boolean; + /** + * Return an array of all traders + * @param sessionID Session id + * @returns array if ITraderBase objects + */ getAllTraders(sessionID: string): ITraderBase[]; - updateTraders(): boolean; + getTrader(sessionID: string, traderID: string): ITraderBase; getAssort(sessionId: string, traderId: string): ITraderAssort; - getPurchasesData(traderID: string, sessionID: string): Record; + getPurchasesData(sessionID: string, traderID: string): Record; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/di/Container.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/di/Container.d.ts index 17791b0..98d1fa1 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/di/Container.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/di/Container.d.ts @@ -1,4 +1,7 @@ import { DependencyContainer } from "tsyringe"; +/** + * Handle the registration of classes to be used by the Dependency Injection code + */ export declare class Container { static registerTypes(depContainer: DependencyContainer): void; static registerListTypes(depContainer: DependencyContainer): void; diff --git a/Live/CWX_WeatherPatcher/server/dist/types/generators/BotGenerator.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/generators/BotGenerator.d.ts index a5fc0ad..2ac51db 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/generators/BotGenerator.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/generators/BotGenerator.d.ts @@ -9,6 +9,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { PmcAiService } from "../services/PmcAiService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -30,9 +31,10 @@ export declare class BotGenerator { protected botEquipmentFilterService: BotEquipmentFilterService; protected botHelper: BotHelper; protected gameEventHelper: GameEventHelper; + protected pmcAiService: PmcAiService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, pmcAiService: PmcAiService, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -40,14 +42,14 @@ export declare class BotGenerator { * @param botTemplate base bot template to use (e.g. assault/pmcbot) * @returns */ - generatePlayerScav(role: string, difficulty: string, botTemplate: IBotType): IBotBase; - generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Choose if a bot should become a PMC by checking if bot type is allowed to become a Pmc in botConfig.convertFromChances and doing a random int check - * @param botRole the bot role to check if should be a pmc - * @returns true if should be a pmc + * Generate an array of bot objects for populate a raid with + * @param sessionId session id + * @param info request object + * @returns bot array */ - protected shouldBotBePmc(botRole: string): boolean; + generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** * Get a randomised PMC side based on bot config value 'isUsec' * @returns pmc side as string @@ -58,12 +60,30 @@ export declare class BotGenerator { * @returns IBotBase object */ protected getCloneOfBotBase(): IBotBase; - protected generateBot(bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + /** + * Create a IBotBase object with equipment/loot/exp etc + * @param sessionId Session id + * @param bot bots base file + * @param role botRole bot will use + * @param node Bot template from db/bots/x.json + * @param isPmc Is bot to be a PMC + * @param isPlayerScav is bot to be a p scav bot + * @returns IBotBase object + */ + protected generateBot(sessionId: string, bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; /** * Log the number of PMCs generated to the debug console + * @param output Generated bot array, ready to send to client */ protected logPmcGeneratedCount(output: IBotBase[]): void; - protected generateRandomLevel(min: number, max: number): BotGenerator.IRandomisedBotLevelResult; + /** + * Return a randomised bot level and exp value + * @param role botRole being generated for + * @param min Min exp value + * @param max Max exp value + * @returns IRandomisedBotLevelResult object + */ + protected generateRandomLevel(role: string, min: number, max: number): BotGenerator.IRandomisedBotLevelResult; /** * Converts health object to the required format * @param healthObj health object from bot json @@ -72,19 +92,23 @@ export declare class BotGenerator { */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; protected generateSkills(skillsObj: Skills): Skills; - /** - * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) - * @param pmcSide eft side (usec/bear) - * @returns pmc side as defined in config - */ - protected getPmcRole(pmcSide: string): string; /** * Iterate through bots inventory and loot to find and remove christmas items (as defined in GameEventHelper) * @param nodeInventory Bots inventory to iterate over */ protected removeChristmasItemsFromBotInventory(nodeInventory: Inventory): void; + /** + * Generate a random Id for a bot and apply to bots _id and aid value + * @param bot bot to update + * @returns updated IBotBase object + */ protected generateId(bot: IBotBase): IBotBase; protected generateInventoryID(profile: IBotBase): IBotBase; + /** + * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * @param requestedDifficulty + * @returns + */ protected getPMCDifficulty(requestedDifficulty: string): string; /** * Add a side-specific (usec/bear) dogtag item to a bots inventory diff --git a/Live/CWX_WeatherPatcher/server/dist/types/generators/BotInventoryGenerator.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/generators/BotInventoryGenerator.d.ts index 35d1ee8..c5ed545 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/generators/BotInventoryGenerator.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/generators/BotInventoryGenerator.d.ts @@ -1,13 +1,16 @@ +import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Inventory, Chances, Generation, Mods } from "../models/eft/common/tables/IBotType"; +import { Chances, Generation, Inventory, Mods } from "../models/eft/common/tables/IBotType"; +import { EquipmentSlots } from "../models/enums/EquipmentSlots"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; -import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; -import { BotWeaponGenerator } from "./BotWeaponGenerator"; import { BotLootGenerator } from "./BotLootGenerator"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; +import { BotWeaponGenerator } from "./BotWeaponGenerator"; export declare class BotInventoryGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -17,8 +20,14 @@ export declare class BotInventoryGenerator { protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper); - generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { + slot: EquipmentSlots; + shouldSpawn: boolean; + }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; protected generateInventoryBase(): PmcInventory; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/generators/BotLootGenerator.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/generators/BotLootGenerator.d.ts index c6a3f29..c1f5310 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/generators/BotLootGenerator.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/generators/BotLootGenerator.d.ts @@ -1,4 +1,5 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; @@ -20,11 +21,12 @@ export declare class BotLootGenerator { protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botLootCacheService: BotLootCacheService, configServer: ConfigServer); - generateLoot(templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer); + generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached @@ -47,7 +49,7 @@ export declare class BotLootGenerator { * @param botRole bots role, .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; /** * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from diff --git a/Live/CWX_WeatherPatcher/server/dist/types/generators/BotWeaponGenerator.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/generators/BotWeaponGenerator.d.ts index 9215214..487901b 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/generators/BotWeaponGenerator.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/generators/BotWeaponGenerator.d.ts @@ -1,4 +1,5 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { MinMax } from "../models/common/MinMax"; @@ -14,6 +15,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { IInventoryMagGen } from "./weapongen/IInventoryMagGen"; export declare class BotWeaponGenerator { protected jsonUtil: JsonUtil; protected logger: ILogger; @@ -24,11 +26,24 @@ export declare class BotWeaponGenerator { protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; protected configServer: ConfigServer; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, inventoryMagGenComponents: IInventoryMagGen[]); /** - * Get a random weapon from a bots pool of weapons (weighted) + * Pick a random weapon based on weightings and generate a functional weapon + * @param equipmentSlot Primary/secondary/holster + * @param botTemplateInventory e.g. assault.json + * @param weaponParentId + * @param modChances + * @param botRole role of bot, e.g. assault/followerBully + * @param isPmc Is weapon generated for a pmc + * @returns GenerateWeaponResult object + */ + generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + /** + * Get a random weighted weapon from a bots pool of weapons * @param equipmentSlot Primary/secondary/holster * @param botTemplateInventory e.g. assault.json * @returns weapon tpl @@ -39,43 +54,24 @@ export declare class BotWeaponGenerator { * @param weaponTpl weapon tpl to generate (use pickWeightedWeaponTplFromPool()) * @param equipmentSlot slot to fit into, primary/secondary/holster * @param botTemplateInventory e.g. assault.json - * @param weaponParentId - * @param modChances - * @param botRole + * @param weaponParentId ParentId of the weapon being generated + * @param modChances Dictionary of item types and % chance weapon will have that mod + * @param botRole e.g. assault/exusec * @param isPmc * @returns GenerateWeaponResult object */ - generateWeaponByTpl(weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; /** - * Generate an entirely random weapon - * @param equipmentSlot Primary/secondary/holster - * @param botTemplateInventory e.g. assault.json - * @param weaponParentId - * @param modChances - * @param botRole - * @param isPmc - * @returns GenerateWeaponResult object - */ - generateRandomWeapon(equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; - /** - * Create array with weapon base as only element - * Add additional properties as required - * @param weaponTpl - * @param weaponParentId - * @param equipmentSlot - * @param weaponItemTemplate + * Create array with weapon base as only element and + * add additional properties based on weapon type + * @param weaponTpl Weapon tpl to create item with + * @param weaponParentId Weapons parent id + * @param equipmentSlot e.g. primary/secondary/holster + * @param weaponItemTemplate db template for weapon * @param botRole for durability values - * @returns + * @returns Base weapon item in array */ - constructWeaponBaseArray(weaponTpl: string, weaponParentId: string, equipmentSlot: string, weaponItemTemplate: ITemplateItem, botRole: string): Item[]; - /** - * Add compatible magazines to an inventory based on a generated weapon - * @param weaponDetails - * @param magCounts - * @param inventory - * @param botRole the bot type we're getting generating extra mags for - */ - addExtraMagazinesToInventory(weaponDetails: GenerateWeaponResult, magCounts: MinMax, inventory: PmcInventory, botRole: string): void; + protected constructWeaponBaseArray(weaponTpl: string, weaponParentId: string, equipmentSlot: string, weaponItemTemplate: ITemplateItem, botRole: string): Item[]; /** * Get the mods necessary to kit out a weapon to its preset level * @param weaponTpl weapon to find preset for @@ -84,33 +80,21 @@ export declare class BotWeaponGenerator { * @returns array of weapon mods */ protected getPresetWeaponMods(weaponTpl: string, equipmentSlot: string, weaponParentId: string, itemTemplate: ITemplateItem, botRole: string): Item[]; - /** Checks if all required slots are occupied on a weapon and all it's mods */ + /** + * Checks if all required slots are occupied on a weapon and all it's mods + * @param weaponItemArray Weapon + mods + * @returns true if valid + */ protected isWeaponValid(weaponItemArray: Item[]): boolean; /** * Generates extra magazines or bullets (if magazine is internal) and adds them to TacticalVest and Pockets. * Additionally, adds extra bullets to SecuredContainer - * @param weaponMods - * @param weaponTemplate - * @param magCounts - * @param ammoTpl - * @param inventory - * @param botRole the bot type we're getting generating extra mags for - * @returns + * @param generatedWeaponResult object with properties for generated weapon (weapon mods pool / weapon template / ammo tpl) + * @param magCounts Magazine count to add to inventory + * @param inventory Inventory to add magazines to + * @param botRole The bot type we're getting generating extra mags for */ - protected generateExtraMagazines(weaponMods: Item[], weaponTemplate: ITemplateItem, magCounts: MinMax, ammoTpl: string, inventory: PmcInventory, botRole: string): void; - /** - * Get a randomised number of bullets for a specific magazine - * @param magCounts min and max count of magazines - * @param magTemplate magazine to generate bullet count for - * @returns bullet count number - */ - protected getRandomisedBulletCount(magCounts: MinMax, magTemplate: ITemplateItem): number; - /** - * Get a randomised count of magazines - * @param magCounts min and max value returned value can be between - * @returns numberical value of magazine count - */ - protected getRandomisedMagazineCount(magCounts: MinMax): number; + addExtraMagazinesToInventory(generatedWeaponResult: GenerateWeaponResult, magCounts: MinMax, inventory: PmcInventory, botRole: string): void; /** * Add ammo to the secure container * @param stackCount How many stacks of ammo to add @@ -127,21 +111,13 @@ export declare class BotWeaponGenerator { * @returns magazine tpl string */ protected getMagazineTplFromWeaponTemplate(weaponMods: Item[], weaponTemplate: ITemplateItem, botRole: string): string; - /** - * Get a weapons default magazine template id - * @param weaponTemplate weapon to get default magazine for - * @returns tpl of magazine - */ - protected getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - protected addBulletsToVestAndPockets(ammoTpl: string, bulletCount: number, inventory: PmcInventory): void; /** * Finds and return a compatible ammo tpl based on the bots ammo weightings (x.json/inventory/equipment/ammo) * @param ammo a list of ammo tpls the weapon can use * @param weaponTemplate the weapon we want to pick ammo for - * @param isPmc is the ammo being gathered for a pmc (runs pmc ammo filtering) * @returns an ammo tpl that works with the desired gun */ - protected getCompatibleAmmo(ammo: Record>, weaponTemplate: ITemplateItem, isPmc: boolean): string; + protected getWeightedCompatibleAmmo(ammo: Record>, weaponTemplate: ITemplateItem): string; /** * Get a weapons compatible cartridge caliber * @param weaponTemplate Weapon to look up caliber of diff --git a/Live/CWX_WeatherPatcher/server/dist/types/generators/LocationGenerator.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/generators/LocationGenerator.d.ts index bd368b5..cc61dcf 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/generators/LocationGenerator.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/generators/LocationGenerator.d.ts @@ -3,10 +3,9 @@ import { GameEventHelper } from "../helpers/GameEventHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; -import { ILooseLoot, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; +import { ILooseLoot, SpawnpointsForced, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; import { Item } from "../models/eft/common/tables/IItem"; import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticLootDetails } from "../models/eft/common/tables/ILootBase"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -36,11 +35,19 @@ export declare class LocationGenerator { generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; + /** + * Create array of loose + forced loot using probability system + * @param dynamicLootDist + * @param staticAmmoDist + * @param locationName Location to generate loot for + * @returns Array of spawn points with loot in them + */ generateDynamicLoot(dynamicLootDist: ILooseLoot, staticAmmoDist: Record, locationName: string): SpawnpointTemplate[]; + /** + * Add forced spawn point loot into loot parameter array + * @param loot array to add forced loot to + * @param forcedSpawnPoints forced loot to add + */ + protected addForcedLoot(loot: SpawnpointTemplate[], forcedSpawnPoints: SpawnpointsForced[]): void; protected createItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; - protected getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; - protected getRandomValidCaliber(magTemplate: ITemplateItem): string; - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; - protected createRandomMagCartridges(magTemplate: ITemplateItem, parentId: string, staticAmmoDist: Record, caliber?: string): Item; - protected createCartidges(parentId: string, ammoTpl: string, stackCount: number): Item; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/generators/LootGenerator.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/generators/LootGenerator.d.ts new file mode 100644 index 0000000..bbc1915 --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/dist/types/generators/LootGenerator.d.ts @@ -0,0 +1,58 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Preset } from "../models/eft/common/IGlobals"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { LootItem } from "../models/spt/services/LootItem"; +import { LootRequest } from "../models/spt/services/LootRequest"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { HashUtil } from "../utils/HashUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class LootGenerator { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected databaseServer: DatabaseServer; + protected randomUtil: RandomUtil; + protected itemHelper: ItemHelper; + protected itemFilterService: ItemFilterService; + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, itemFilterService: ItemFilterService); + /** + * Generate a list of items based on options passed in + * @param options parameters to adjust what loot is generated + * @returns An array of loot items + */ + createRandomloot(options: LootRequest): LootItem[]; + /** + * Construct item limit record to hold max and current item count + * @param limits limits as defined in config + * @returns record, key: item tplId, value: current/max item count allowed + */ + protected initItemLimitCounter(limits: Record): Record; + /** + * Find a random item in items.json and add to result array + * @param items items to choose from + * @param itemTypeCounts item limit counts + * @param options item filters + * @param result array to add found item to + * @returns true if item was valid and added to pool + */ + protected findAndAddRandomItemToLoot(items: [string, ITemplateItem][], itemTypeCounts: Record, options: LootRequest, result: LootItem[]): boolean; + /** + * + * Find a random item in items.json and add to result array + * @param globalDefaultPresets presets to choose from + * @param itemTypeCounts item limit counts + * @param result array to add found preset to + * @returns true if preset was valid and added to pool + */ + protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, Preset][], itemTypeCounts: Record, result: LootItem[]): boolean; +} diff --git a/Live/CWX_WeatherPatcher/server/dist/types/generators/PMCLootGenerator.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/generators/PMCLootGenerator.d.ts index 64e6f7f..b9f2a83 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/generators/PMCLootGenerator.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/generators/PMCLootGenerator.d.ts @@ -1,15 +1,21 @@ import { ItemHelper } from "../helpers/ItemHelper"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ConfigServer } from "../servers/ConfigServer"; import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +/** + * Handle the generation of dynamic PMC loot in pockets and backpacks + * and the removal of blacklisted items + */ export declare class PMCLootGenerator { protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; + protected itemFilterService: ItemFilterService; protected pocketLootPool: string[]; protected backpackLootPool: string[]; protected botConfig: IBotConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService); generatePMCPocketLootPool(): string[]; generatePMCBackpackLootPool(): string[]; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/generators/RagfairAssortGenerator.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/generators/RagfairAssortGenerator.d.ts index cbdd7f2..db4811d 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/generators/RagfairAssortGenerator.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/generators/RagfairAssortGenerator.d.ts @@ -1,5 +1,8 @@ import { ItemHelper } from "../helpers/ItemHelper"; +import { Preset } from "../models/eft/common/IGlobals"; import { Item } from "../models/eft/common/tables/IItem"; +import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -8,18 +11,40 @@ export declare class RagfairAssortGenerator { protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; protected generatedAssortItems: Item[]; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer); + protected ragfairConfig: IRagfairConfig; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); /** * Get an array of unique items that can be sold on the flea * @returns array of unique items */ getAssortItems(): Item[]; + /** + * Check internal generatedAssortItems array has objects + * @returns true if array has objects + */ protected assortsAreGenerated(): boolean; /** * Generate an array of items the flea can sell * @returns array of unique items */ protected generateRagfairAssortItems(): Item[]; + /** + * Get presets from globals.json + * @returns Preset object array + */ + protected getPresets(): Preset[]; + /** + * Get default presets from globals.json + * @returns Preset object array + */ + protected getDefaultPresets(): Preset[]; + /** + * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true + * @param tplId tplid to add to item + * @param id id to add to item + * @returns hydrated Item object + */ protected createRagfairAssortItem(tplId: string, id?: string): Item; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/generators/RagfairOfferGenerator.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/generators/RagfairOfferGenerator.d.ts index 3e7f4cc..317cd6b 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/generators/RagfairOfferGenerator.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/generators/RagfairOfferGenerator.d.ts @@ -41,15 +41,37 @@ export declare class RagfairOfferGenerator { createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; protected getTraderId(userID: string): string; protected getRating(userID: string): number; + /** + * Is the offers user rating growing + * @param userID user to check rating of + * @returns true if its growing + */ protected getRatingGrowing(userID: string): boolean; + /** + * Get number of section until offer should expire + * @param userID Id of the offer owner + * @param time Time the offer is posted + * @returns number of seconds until offer expires + */ protected getOfferEndTime(userID: string, time: number): number; /** * Create multiple offers for items by using a unique list of items we've generated previously - * @param expiredOffers + * @param expiredOffers optional, expired offers to regenerate */ generateDynamicOffers(expiredOffers?: Item[]): void; - generateTraderOffers(traderID: string): void; + /** + * Generate trader offers on flea using the traders assort data + * @param traderID Trader to generate offers for + */ + generateFleaOffersForTrader(traderID: string): void; protected getItemCondition(userID: string, items: Item[], itemDetails: ITemplateItem): Item[]; + /** + * Add missing conditions to an item if needed + * Durabiltiy for repairable items + * HpResource for medical items + * @param item item to add conditions to + * @returns Item with conditions added + */ protected addMissingCondition(item: Item): Item; protected getOfferRequirements(items: Item[]): { count: number; @@ -57,6 +79,14 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a flea offer and store it in the Ragfair server offers array + * @param userID owner of the offer + * @param time time offer is put up + * @param items items in the offer + * @param barterScheme + * @param loyalLevel + * @param price price of offer + * @param sellInOnePiece + * @returns */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/generators/ScavCaseRewardGenerator.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/generators/ScavCaseRewardGenerator.d.ts index c7d6ab7..89cb5c8 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/generators/ScavCaseRewardGenerator.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/generators/ScavCaseRewardGenerator.d.ts @@ -8,9 +8,13 @@ import { RewardCountAndPriceDetails, ScavCaseRewardCountsAndPrices } from "../mo import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { RagfairPriceService } from "../services/RagfairPriceService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +/** + * Handle the creation of randomised scav case rewards + */ export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; @@ -18,9 +22,10 @@ export declare class ScavCaseRewardGenerator { protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param body client request diff --git a/Live/CWX_WeatherPatcher/server/dist/types/generators/WeatherGenerator.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/generators/WeatherGenerator.d.ts index 44cecbb..8ddbe49 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/generators/WeatherGenerator.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/generators/WeatherGenerator.d.ts @@ -1,7 +1,7 @@ import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { ConfigServer } from "../servers/ConfigServer"; import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class WeatherGenerator { @@ -21,11 +21,16 @@ export declare class WeatherGenerator { protected getAcceleratedTime(computedDate: Date): string; /** * Get current time formatted to fit BSGs requirement - * @param computedDate + * @param computedDate date to format into bsg style * @returns */ protected getNormalTime(computedDate: Date): string; - generateWeather(data: IWeatherData): IWeatherData; + /** + * Return randomised Weather data + * @param weatherData weather input data + * @returns Randomised weather data + */ + generateWeather(weatherData: IWeatherData): IWeatherData; protected getWeightedFog(): string; protected getWeightedRain(): number; protected getRandomFloat(node: string): number; diff --git a/Live/CWX_WeatherPatcher/server/dist/types/generators/weapongen/IInventoryMagGen.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/generators/weapongen/IInventoryMagGen.d.ts new file mode 100644 index 0000000..792f510 --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/dist/types/generators/weapongen/IInventoryMagGen.d.ts @@ -0,0 +1,6 @@ +import { InventoryMagGen } from "./InventoryMagGen"; +export interface IInventoryMagGen { + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_WeatherPatcher/server/dist/types/generators/weapongen/InventoryMagGen.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/generators/weapongen/InventoryMagGen.d.ts new file mode 100644 index 0000000..30bf79f --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/dist/types/generators/weapongen/InventoryMagGen.d.ts @@ -0,0 +1,16 @@ +import { MinMax } from "../../models/common/MinMax"; +import { Inventory } from "../../models/eft/common/tables/IBotBase"; +import { ITemplateItem } from "../../models/eft/common/tables/ITemplateItem"; +export declare class InventoryMagGen { + private magCounts; + private magazineTemplate; + private weaponTemplate; + private ammoTemplate; + private pmcInventory; + constructor(magCounts: MinMax, magazineTemplate: ITemplateItem, weaponTemplate: ITemplateItem, ammoTemplate: ITemplateItem, pmcInventory: Inventory); + getMagCount(): MinMax; + getMagazineTemplate(): ITemplateItem; + getWeaponTemplate(): ITemplateItem; + getAmmoTemplate(): ITemplateItem; + getPmcInventory(): Inventory; +} diff --git a/Live/CWX_WeatherPatcher/server/dist/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts new file mode 100644 index 0000000..b754d5f --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/dist/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts @@ -0,0 +1,12 @@ +import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; +import { RandomUtil } from "../../../utils/RandomUtil"; +import { IInventoryMagGen } from "../IInventoryMagGen"; +import { InventoryMagGen } from "../InventoryMagGen"; +export declare class BarrelInventoryMagGen implements IInventoryMagGen { + protected randomUtil: RandomUtil; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + constructor(randomUtil: RandomUtil, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_WeatherPatcher/server/dist/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts new file mode 100644 index 0000000..4fcb1e2 --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/dist/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -0,0 +1,14 @@ +import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; +import { ItemHelper } from "../../../helpers/ItemHelper"; +import { ILogger } from "../../../models/spt/utils/ILogger"; +import { IInventoryMagGen } from "../IInventoryMagGen"; +import { InventoryMagGen } from "../InventoryMagGen"; +export declare class ExternalInventoryMagGen implements IInventoryMagGen { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + constructor(logger: ILogger, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_WeatherPatcher/server/dist/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts new file mode 100644 index 0000000..4548a04 --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/dist/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts @@ -0,0 +1,10 @@ +import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; +import { IInventoryMagGen } from "../IInventoryMagGen"; +import { InventoryMagGen } from "../InventoryMagGen"; +export declare class InternalMagazineInventoryMagGen implements IInventoryMagGen { + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + constructor(botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_WeatherPatcher/server/dist/types/helpers/AssortHelper.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/helpers/AssortHelper.d.ts index 15586b9..bfc157f 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/helpers/AssortHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/helpers/AssortHelper.d.ts @@ -17,7 +17,7 @@ export declare class AssortHelper { * @param assort assort items from a trader * @returns assort items minus locked quest assorts */ - stripLockedQuestAssort(pmcProfile: IPmcData, traderId: string, assort: ITraderAssort): ITraderAssort; + stripLockedQuestAssort(pmcProfile: IPmcData, traderId: string, assort: ITraderAssort, flea?: boolean): ITraderAssort; /** * Remove assorts from a trader that have not been unlocked yet * @param pmcProfile player profile @@ -32,5 +32,5 @@ export declare class AssortHelper { * @param itemID item id to remove from asort * @returns Modified assort */ - removeItemFromAssort(assort: ITraderAssort, itemID: string): ITraderAssort; + removeItemFromAssort(assort: ITraderAssort, itemID: string, flea?: boolean): ITraderAssort; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/helpers/BotGeneratorHelper.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/helpers/BotGeneratorHelper.d.ts index 3cd7256..5e3e501 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/helpers/BotGeneratorHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/helpers/BotGeneratorHelper.d.ts @@ -1,19 +1,33 @@ import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper"; -import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem"; -import { Grid, ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { ItemFilterService } from "../services/ItemFilterService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotWeaponGeneratorHelper } from "./BotWeaponGeneratorHelper"; import { ContainerHelper } from "./ContainerHelper"; import { InventoryHelper } from "./InventoryHelper"; import { ItemHelper } from "./ItemHelper"; import { ProbabilityHelper } from "./ProbabilityHelper"; +import { ProfileHelper } from "./ProfileHelper"; +export declare class BotModLimits { + scope: ItemCount; + scopeMax: number; + scopeBaseTypes: string[]; + flashlightLaser: ItemCount; + flashlightLaserMax: number; + flashlgihtLaserBaseTypes: string[]; +} +export declare class ItemCount { + count: number; +} export declare class BotGeneratorHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -25,16 +39,121 @@ export declare class BotGeneratorHelper { protected itemHelper: ItemHelper; protected inventoryHelper: InventoryHelper; protected containerHelper: ContainerHelper; + protected botEquipmentFilterService: BotEquipmentFilterService; + protected itemFilterService: ItemFilterService; + protected profileHelper: ProfileHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, configServer: ConfigServer); - generateModsForItem(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, configServer: ConfigServer); /** - * Is this magazine cylinder related (revolvers and grenade launchers) - * @param magazineParentName the name of the magazines parent - * @returns true if it is cylinder related + * Check mods are compatible and add to array + * @param equipment Equipment item to add mods to + * @param modPool Mod list to choose frm + * @param parentId parentid of item to add mod to + * @param parentTemplate template objet of item to add mods to + * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @returns Item + compatible mods as an array */ - magazineIsCylinderRelated(magazineParentName: string): boolean; + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + /** + * @param sessionId session id + * @param weapon Weapon to add mods to + * @param modPool Pool of compatible mods to attach to weapon + * @param weaponParentId parentId of weapon + * @param parentWeaponTemplate Weapon which mods will be generated on + * @param modSpawnChances Mod spawn chances + * @param ammoTpl Ammo tpl to use when generating magazines/cartridges + * @param botRole Role of bot weapon is generated for + * @returns Weapon + mods array + */ + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; + /** + * + * @param modSlot + * @param isRandomisableSlot + * @param modsParent + * @param botEquipBlacklist + * @param itemModPool + * @param weapon array with only weapon tpl in it, ready for mods to be added + * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) + * @param parentTemplate + * @returns + */ + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + /** + * Find mod tpls of a provided type and add to modPool + * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) + * @param modTemplate db object for modItem we get compatible mods from + * @param modPool Pool of mods we are adding to + */ + protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; + /** + * Check if mod item is on limited list + has surpassed the limit set for it + * @param botRole role the bot has e.g. assault + * @param modTemplate mods template data + * @param modLimits limits set for weapon being generated for this bot + * @returns true if over item limit + */ + protected modHasReachedItemLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits): boolean; + /** + * Initalise mod limits to be used when generating a weapon + * @param botRole "assault", "bossTagilla" or "pmc" + * @returns BotModLimits object + */ + protected initModLimits(botRole: string): BotModLimits; + /** + * Generate a pool of mods for this bots mod type if bot has values inside `randomisedWeaponModSlots` array found in bot.json/equipment[botrole] + * @param allowedMods Mods to be added to mod pool + * @param botEquipBlacklist blacklist of items not allowed to be added to mod pool + * @param modSlot Slot to generate mods for + * @param itemModPool base mod pool to replace values of + */ + protected generateDynamicWeaponModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record): void; + /** + * Find all compatible mods for equipment item and add to modPool + * @param itemDetails item to find mods for + * @param modPool ModPool to add mods to + */ + generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods): void; + /** + * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist + * @param allowedMods base mods to filter + * @param botEquipBlacklist equipment blacklist + * @param modSlot slot mods belong to + * @returns Filtered array of mod tpls + */ + protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; + /** + * Check if the specific item type on the weapon has reached the set limit + * @param modTpl log mod tpl if over type limit + * @param currentCount current number of this item on gun + * @param maxLimit mod limit allowed + * @param botRole role of bot we're checking weapon of + * @returns true if limit reached + */ + protected weaponModLimitReached(modTpl: string, currentCount: { + count: number; + }, maxLimit: number, botRole: string): boolean; + /** + * Log errors if mod is not compatible with slot + * @param modToAdd template of mod to check + * @param itemSlot slot the item will be placed in + * @param modSlot slot the mod will fill + * @param parentTemplate tempalte of the mods parent item + * @returns true if valid + */ + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + /** + * Create a mod item with parameters as properties + * @param modId _id + * @param modTpl _tpl + * @param parentId parentId + * @param modSlot slotId + * @param modTemplate Used to add additional properites in the upd object + * @returns Item object + */ + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem): Item; /** * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance @@ -46,7 +165,7 @@ export declare class BotGeneratorHelper { protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; /** * Get a list of containers that hold ammo - * e.g. mod_magazine + * e.g. mod_magazine / patron_in_weapon_000 * @returns string array */ protected getAmmoContainers(): string[]; @@ -62,11 +181,11 @@ export declare class BotGeneratorHelper { * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" - * - * @param {object} items The items where the CylinderMagazine's camora are appended to - * @param {object} modPool modPool which should include available cartrigdes - * @param {string} parentId The CylinderMagazine's UID - * @param {object} parentTemplate The CylinderMagazine's template + * @param items The items where the CylinderMagazine's camora are appended to + * @param modPool modPool which should include available cartrigdes + * @param parentId The CylinderMagazine's UID + * @param parentTemplate The CylinderMagazine's template + * @returns */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** @@ -75,6 +194,13 @@ export declare class BotGeneratorHelper { * @returns string array of shells fro luitple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + /** + * Adds properties to an item + * e.g. Repairable / HasHinge / Foldable / MaxDurability + * @param itemTemplate + * @param botRole Used by weapons to randomise the durability values + * @returns Item Upd object with extra properties + */ generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { upd?: Upd; }; @@ -92,13 +218,15 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; - protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** - * Sort by spawn chance, highest to lowest, higher is more common - * @param unsortedModArray String array to sort - * @returns Sorted string array + * Get a random mod from an items compatible mods Filter array + * @param modTpl + * @param parentSlot + * @param modSlot + * @param items + * @returns item tpl */ - protected sortModArray(unsortedModArray: string[]): string[]; + protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** * Can an item be added to an item without issue * @param items @@ -107,18 +235,8 @@ export declare class BotGeneratorHelper { * @returns true if possible */ isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; - /** - * Adds an item with all its childern into specified equipmentSlots, wherever it fits. - * @param equipmentSlots - * @param parentId - * @param parentTpl - * @param itemWithChildren - * @param inventory - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: PmcInventory): boolean; - protected itemAllowedInContainer(slot: Grid, itemTpl: string): boolean; } +/** TODO - move into own class */ export declare class ExhaustableArray { private itemPool; private randomUtil; diff --git a/Live/CWX_WeatherPatcher/server/dist/types/helpers/BotHelper.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/helpers/BotHelper.d.ts index 9b89481..18738e5 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/helpers/BotHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/helpers/BotHelper.d.ts @@ -13,11 +13,34 @@ export declare class BotHelper { protected configServer: ConfigServer; protected botConfig: IBotConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, configServer: ConfigServer); + /** + * Get difficulty settings for desired bot type, if not found use assault bot types + * @param type bot type to retreive difficulty of + * @param difficulty difficulty to get settings for (easy/normal etc) + * @returns Difficulty object + */ getBotDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Get a template object for the specified botRole from bots.types db + * @param role botRole to get template for + * @returns IBotType object + */ getBotTemplate(role: string): IBotType; + /** + * Get difficulty settings for a PMC + * @param type "usec" / "bear" + * @param difficulty what difficulty to retrieve + * @returns Difficulty object + */ getPmcDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Choose a random difficulty from - easy/normal/hard/impossible + * @returns random difficulty + */ + chooseRandomDifficulty(): string; /** * Randomise the chance the PMC will attack their own side + * Look up value in bot.json/chanceSameSideIsHostilePercent * @param difficultySettings pmc difficulty settings */ randomisePmcHostility(difficultySettings: Difficulty): void; @@ -31,7 +54,7 @@ export declare class BotHelper { */ addBotToFriendlyList(difficultySettings: Difficulty, typeToAdd: string): void; /** - * Add a bot to the ENEMY_BOT_TYPES array + * Add a bot to the ENEMY_BOT_TYPES array, do not add itself if its on the enemy list * @param difficultySettings bot settings to alter * @param typesToAdd bot type to add to enemy list */ @@ -42,4 +65,10 @@ export declare class BotHelper { * @param typesToAdd bot type to add to revenge list */ addBotToRevengeList(difficultySettings: Difficulty, typesToAdd: string[]): void; + /** + * Choose if a bot should become a PMC by checking if bot type is allowed to become a Pmc in botConfig.convertFromChances and doing a random int check + * @param botRole the bot role to check if should be a pmc + * @returns true if should be a pmc + */ + shouldBotBePmc(botRole: string): boolean; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/helpers/BotWeaponGeneratorHelper.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/helpers/BotWeaponGeneratorHelper.d.ts new file mode 100644 index 0000000..7e25f56 --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/dist/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -0,0 +1,78 @@ +import { MinMax } from "../models/common/MinMax"; +import { Inventory } from "../models/eft/common/tables/IBotBase"; +import { Item } from "../models/eft/common/tables/IItem"; +import { Grid, ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { HashUtil } from "../utils/HashUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { ContainerHelper } from "./ContainerHelper"; +import { InventoryHelper } from "./InventoryHelper"; +import { ItemHelper } from "./ItemHelper"; +export declare class BotWeaponGeneratorHelper { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper); + /** + * Get a randomised number of bullets for a specific magazine + * @param magCounts min and max count of magazines + * @param magTemplate magazine to generate bullet count for + * @returns bullet count number + */ + getRandomisedBulletCount(magCounts: MinMax, magTemplate: ITemplateItem): number; + /** + * Get a randomised count of magazines + * @param magCounts min and max value returned value can be between + * @returns numberical value of magazine count + */ + getRandomisedMagazineCount(magCounts: MinMax): number; + /** + * Is this magazine cylinder related (revolvers and grenade launchers) + * @param magazineParentName the name of the magazines parent + * @returns true if it is cylinder related + */ + magazineIsCylinderRelated(magazineParentName: string): boolean; + /** + * Create a magazine using the parameters given + * @param magazineTpl Tpl of the magazine to create + * @param ammoTpl Ammo to add to magazine + * @param magTemplate template object of magazine + * @returns Item array + */ + createMagazine(magazineTpl: string, ammoTpl: string, magTemplate: ITemplateItem): Item[]; + /** + * Add a specific number of cartrdiges to a bots inventory (vest/pocket) + * @param ammoTpl Ammo tpl to add to vest/pockets + * @param cartridgeCount number of cartridges to add to vest/pockets + * @param inventory bot inventory to add cartridges to + */ + addBulletsToVestAndPockets(ammoTpl: string, cartridgeCount: number, inventory: Inventory): void; + /** + * Get a weapons default magazine template id + * @param weaponTemplate weapon to get default magazine for + * @returns tpl of magazine + */ + getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; + /** + * Adds an item with all its childern into specified equipmentSlots, wherever it fits. + * @param equipmentSlots + * @param parentId + * @param parentTpl + * @param itemWithChildren + * @param inventory + * @returns a `boolean` indicating item was added + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): boolean; + /** + * is the provided item allowed inside a container + * @param slot location item wants to be placed in + * @param itemTpl item being placed + * @returns true if allowed + */ + protected itemAllowedInContainer(slot: Grid, itemTpl: string): boolean; +} diff --git a/Live/CWX_WeatherPatcher/server/dist/types/helpers/HideoutHelper.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/helpers/HideoutHelper.d.ts index 36e4009..7495a6a 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/helpers/HideoutHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/helpers/HideoutHelper.d.ts @@ -44,14 +44,72 @@ export declare class HideoutHelper { initProduction(recipeId: string, productionTime: number): Production; isProductionType(productive: Productive): productive is Production; applyPlayerUpgradesBonuses(pmcData: IPmcData, bonus: StageBonus): void; + /** + * TODO: + * After looking at the skills there doesnt seem to be a configuration per skill to boost + * the XP gain PER skill. I THINK you should be able to put the variable "SkillProgress" (just like health has it) + * and be able to tune the skill gain PER skill, but I havent tested it and Im not sure! + * @param pmcData + * @param bonus + */ protected applySkillXPBoost(pmcData: IPmcData, bonus: StageBonus): void; + /** + * Process a players hideout, update areas that use resources + increment production timers + * @param sessionID Session id + */ updatePlayerHideout(sessionID: string): void; + /** + * Update progress timer for water collector + * @param pmcData profile to update + * @param productionId id of water collection production to update + * @param hideoutProperties Hideout properties + */ + protected updateWaterCollectorProductionTimer(pmcData: IPmcData, productionId: string, hideoutProperties: { + btcFarmCGs?: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Update progress timer for scav case + * @param pmcData Profile to update + * @param productionId Id of scav case production to update + */ + protected updateScavCaseProductionTimer(pmcData: IPmcData, productionId: string): void; + /** + * Iterate over hideout areas that use resources (fuel/filters etc) and update associated values + * @param sessionID Session id + * @param pmcData Profile to update areas of + * @param hideoutProperties hideout properties + */ + protected updateAreasWithResources(sessionID: string, pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): HideoutArea; - protected updateWaterFilters(waterFilterArea: HideoutArea, pwProd: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; + /** + * Adjust water filter objects resourceValue or delete when they reach 0 resource + * @param waterFilterArea water filter area to update + * @param production production object + * @param isGeneratorOn is generatory enabled + * @param pmcData Player profile + * @returns Updated HideoutArea object + */ + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): HideoutArea; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; protected getBTCSlots(pmcData: IPmcData): number; protected getManagementSkillsSlots(): number; diff --git a/Live/CWX_WeatherPatcher/server/dist/types/helpers/InRaidHelper.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/helpers/InRaidHelper.d.ts index c3cbfbb..962df38 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/helpers/InRaidHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -15,19 +16,8 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); - /** - * Reset the SPT inraid property stored in a profile to 'none' - * @param sessionID Session id - */ - protected removePlayer(sessionID: string): void; - /** - * Some maps have one-time-use keys (e.g. Labs - * Remove the relevant key from an inventory based on the post-raid request data passed in - * @param offraidData post-raid data - * @param sessionID Session id - */ - protected removeMapAccessKey(offraidData: ISaveProgressRequestData, sessionID: string): void; + protected profileFixerService: ProfileFixerService; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); /** * Check an array of items and add an upd object to money items with a stack count of 1 * Single stack money items have no upd object and thus no StackObjectsCount, causing issues @@ -52,6 +42,18 @@ export declare class InRaidHelper { * @returns Reset profile object */ updateProfileBaseStats(profileData: IPmcData, saveProgressRequest: ISaveProgressRequestData, sessionID: string): IPmcData; + /** + * Some maps have one-time-use keys (e.g. Labs + * Remove the relevant key from an inventory based on the post-raid request data passed in + * @param offraidData post-raid data + * @param sessionID Session id + */ + protected removeMapAccessKey(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Set the SPT inraid location Profile property to 'none' + * @param sessionID Session id + */ + protected setPlayerInRaidLocationStatusToNone(sessionID: string): void; /** * Adds SpawnedInSession property to items found in a raid * Removes SpawnedInSession for non-scav players if item was taken into raid with SpawnedInSession = true @@ -93,5 +95,10 @@ export declare class InRaidHelper { * @returns true if item is kept after death */ isItemKeptAfterDeath(slotId: string): boolean; + /** + * Return the equipped items from a players inventory + * @param items Players inventory to search through + * @returns an array of equipped items + */ getPlayerGear(items: Item[]): Item[]; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/helpers/InventoryHelper.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/helpers/InventoryHelper.d.ts index dc7cbca..b8e5c9d 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/helpers/InventoryHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/helpers/InventoryHelper.d.ts @@ -43,6 +43,7 @@ export declare class InventoryHelper { constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; diff --git a/Live/CWX_WeatherPatcher/server/dist/types/helpers/ItemHelper.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/helpers/ItemHelper.d.ts index 1701c62..0effaf2 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/helpers/ItemHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/helpers/ItemHelper.d.ts @@ -1,35 +1,30 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { InsuredItem } from "../models/eft/common/tables/IBotBase"; import { Item, Repairable } from "../models/eft/common/tables/IItem"; +import { IStaticAmmoDetails } from "../models/eft/common/tables/ILootBase"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ObjectId } from "../utils/ObjectId"; +import { RandomUtil } from "../utils/RandomUtil"; declare class ItemHelper { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected randomUtil: RandomUtil; + protected objectId: ObjectId; + protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer); /** - * Checks if a id is a valid item. Valid meaning that it's an item that be stored in stash + * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl * @returns boolean; true for items that may be in player posession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {*} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - isValidRewardItem(tpl: string): boolean; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - getRewardableItems(): [string, ITemplateItem][]; /** * Check if the tpl / template Id provided is a descendent of the baseclass * @@ -84,6 +79,11 @@ declare class ItemHelper { * @returns {array} The array of StackSlotItems */ generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; + /** + * Get cloned copy of all item data from items.json + * @returns array of ITemplateItem objects + */ + getItems(): ITemplateItem[]; /** * Gets item data from items.json * @param tpl items template id to look up @@ -196,6 +196,22 @@ declare class ItemHelper { * @returns ItemSize object (width and height) */ getItemSize(items: Item[], rootItemId: string): ItemHelper.ItemSize; + /** + * Get a random cartridge from an items Filter property + * @param item + * @returns + */ + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + createRandomMagCartridges(magTemplate: ITemplateItem, parentId: string, staticAmmoDist: Record, caliber?: string): Item; + protected getRandomValidCaliber(magTemplate: ITemplateItem): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + createCartidges(parentId: string, ammoTpl: string, stackCount: number): Item; + /** + * Get the size of a stack, return 1 if no stack object count property found + * @param item Item to get stack size of + * @returns size of stack + */ + getItemStackSize(item: Item): number; } declare namespace ItemHelper { interface ItemSize { diff --git a/Live/CWX_WeatherPatcher/server/dist/types/helpers/ProfileHelper.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/helpers/ProfileHelper.d.ts index 6c150c8..9c6560a 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/helpers/ProfileHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/helpers/ProfileHelper.d.ts @@ -2,24 +2,41 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Stats } from "../models/eft/common/tables/IBotBase"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; +import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { ItemHelper } from "./ItemHelper"; export declare class ProfileHelper { + protected logger: ILogger; protected jsonUtil: JsonUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected profileSnapshotService: ProfileSnapshotService; protected fenceService: FenceService; - constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; getCompleteProfile(sessionID: string): IPmcData[]; + /** + * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen + * Server saves the post-raid changes prior to the xp screen getting the profile, this results in the xp screen using + * the now updated profile values as a base, meaning it shows x2 xp gained + * Instead, clone the post-raid profile (so we dont alter its values), apply the pre-raid xp values to the cloned objects and return + * Delete snapshot of pre-raid profile prior to returning profile data + * @param sessionId Session id + * @param output pmc and scav profiles array + * @param pmcProfile post-raid pmc profile + * @param scavProfile post-raid scav profile + * @returns updated profile array + */ + protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; /** * Add experience to a PMC inside the players profile diff --git a/Live/CWX_WeatherPatcher/server/dist/types/helpers/QuestHelper.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/helpers/QuestHelper.d.ts index 0f68cd5..d66d150 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/helpers/QuestHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/helpers/QuestHelper.d.ts @@ -36,13 +36,30 @@ export declare class QuestHelper { protected configServer: ConfigServer; protected questConfig: IQuestConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); - questStatus(pmcData: IPmcData, questID: string): QuestStatus; /** - * returns true is the condition is satisfied + * Get status of a quest by quest id + * @param pmcData Profile to search + * @param questID Quest id to look up + * @returns QuestStauts enum + */ + getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus; + /** + * returns true is the level condition is satisfied + * @param playerLevel Players level + * @param condition Quest condition + * @returns true if player level is greater than or equal to quest */ - evaluateLevel(pmcProfile: IPmcData, cond: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; - rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progress: number): void; + /** + * Increase skill points of a skill on player profile + * @param sessionID Session id + * @param pmcData Player profile + * @param output output object to send back to client + * @param skillName Name of skill to increase skill points of + * @param progressAmount Amount of skill points to add to skill + */ + rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; getQuestLocale(questId: string): any; /** * Debug Routine for showing some information on the diff --git a/Live/CWX_WeatherPatcher/server/dist/types/helpers/RagfairOfferHelper.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/helpers/RagfairOfferHelper.d.ts index 8d03bee..e9d72ca 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/helpers/RagfairOfferHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/helpers/RagfairOfferHelper.d.ts @@ -22,12 +22,14 @@ import { ProfileHelper } from "./ProfileHelper"; import { RagfairHelper } from "./RagfairHelper"; import { RagfairServerHelper } from "./RagfairServerHelper"; import { RagfairSortHelper } from "./RagfairSortHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class RagfairOfferHelper { protected logger: ILogger; protected timeUtil: TimeUtil; protected hashUtil: HashUtil; protected itemEventRouter: ItemEventRouter; protected databaseServer: DatabaseServer; + protected traderHelper: TraderHelper; protected saveServer: SaveServer; protected dialogueHelper: DialogueHelper; protected itemHelper: ItemHelper; @@ -43,10 +45,10 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; - processOffers(sessionID: string): boolean; + processOffersOnProfile(sessionID: string): boolean; protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; diff --git a/Live/CWX_WeatherPatcher/server/dist/types/helpers/RagfairSellHelper.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/helpers/RagfairSellHelper.d.ts index 6ec004a..91b8a20 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/helpers/RagfairSellHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/helpers/RagfairSellHelper.d.ts @@ -11,6 +11,12 @@ export declare class RagfairSellHelper { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateSellChance(baseChance: number, offerPrice: number, requirementsPriceInRub: number): number; - rollForSale(sellChance: number, count: number): SellResult[]; + calculateSellChance(baseChancePercent: number, offerPriceRub: number, playerListedPriceRub: number): number; + /** + * Determine if the offer being listed will be sold + * @param sellChancePercent chance item will sell + * @param itemSellCount count of items to sell + * @returns Array of purchases of item(s) lsited + */ + rollForSale(sellChancePercent: number, itemSellCount: number): SellResult[]; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/helpers/RagfairServerHelper.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/helpers/RagfairServerHelper.d.ts index e4939d1..a03cdda 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/helpers/RagfairServerHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/helpers/RagfairServerHelper.d.ts @@ -6,6 +6,7 @@ import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -13,6 +14,9 @@ import { RandomUtil } from "../utils/RandomUtil"; import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { ProfileHelper } from "./ProfileHelper"; +/** + * Helper class for common ragfair server actions + */ export declare class RagfairServerHelper { protected randomUtil: RandomUtil; protected hashUtil: HashUtil; @@ -23,11 +27,12 @@ export declare class RagfairServerHelper { protected localeService: LocaleService; protected dialogueHelper: DialogueHelper; protected jsonUtil: JsonUtil; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; protected static goodsReturnedTemplate: string; - constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); + constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Is item valid / on blacklist / quest item * @param itemDetails diff --git a/Live/CWX_WeatherPatcher/server/dist/types/helpers/RepairHelper.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/helpers/RepairHelper.d.ts index 9a3ab29..5b09320 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/helpers/RepairHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/helpers/RepairHelper.d.ts @@ -14,8 +14,17 @@ export declare class RepairHelper { protected configServer: ConfigServer; protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); - updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit?: boolean, applyRandomDegradation?: boolean): Item; - protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number): number; - protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, armorMax: number): number; + /** + * + * @param itemToRepair item to update durability details + * @param itemToRepairDetails db details of item to repair + * @param isArmor Is item being repaired a piece of armor + * @param amountToRepair how many unit of durability to repair + * @param useRepairKit Is item being repaired with a repair kit + * @param applyMaxDurabilityDegradation should item have max durability reduced + */ + updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit: boolean, traderQualityMultipler: number, applyMaxDurabilityDegradation?: boolean): void; + protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number, traderQualityMultipler: number): number; + protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, weaponMax: number, traderQualityMultipler: number): number; isWeaponTemplate(tpl: string): boolean; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/helpers/TradeHelper.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/helpers/TradeHelper.d.ts index 975062b..7ab9768 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/helpers/TradeHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/helpers/TradeHelper.d.ts @@ -39,6 +39,12 @@ export declare class TradeHelper { * @returns */ sellItem(pmcData: IPmcData, body: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Increment the assorts buy count by number of items purchased + * Show error on screen if player attepts 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; protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/helpers/TraderAssortHelper.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/helpers/TraderAssortHelper.d.ts index 91ba6b9..025efd6 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/helpers/TraderAssortHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/helpers/TraderAssortHelper.d.ts @@ -1,7 +1,7 @@ import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator"; import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; import { Item } from "../models/eft/common/tables/IItem"; -import { ITraderAssort } from "../models/eft/common/tables/ITrader"; +import { ITrader, ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -10,13 +10,16 @@ import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; +import { TimeUtil } from "../utils/TimeUtil"; import { AssortHelper } from "./AssortHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class TraderAssortHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; protected mathUtil: MathUtil; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected assortHelper: AssortHelper; @@ -24,18 +27,32 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts + * Filter out assorts not unlocked due to level OR quest completion * @param sessionId session id - * @param traderId trader id - * @returns a traders assorts + * @param traderId traders id + * @returns a traders' assorts */ - getAssort(sessionId: string, traderId: string): ITraderAssort; + getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset a traders assorts and move nextResupply value to future + * Flag trader as needing a flea offer reset to be picked up by flea update() function + * @param trader trader details to alter + */ + resetExpiredTrader(trader: ITrader): void; + /** + * Does the supplied trader need its assorts refreshed + * @param traderID Trader to check + * @returns true they need refreshing + */ + traderAssortsHaveExpired(traderID: string): boolean; /** * Iterate over all assorts barter_scheme values, find barters selling for money and multiply by multipler in config * @param traderAssort Assorts to multiple price of diff --git a/Live/CWX_WeatherPatcher/server/dist/types/helpers/TraderHelper.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/helpers/TraderHelper.d.ts index b2e9d38..0dc93e8 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/helpers/TraderHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/helpers/TraderHelper.d.ts @@ -9,6 +9,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { PlayerService } from "../services/PlayerService"; +import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -23,9 +24,10 @@ export declare class TraderHelper { protected handbookHelper: HandbookHelper; protected playerService: PlayerService; protected fenceService: FenceService; + protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -63,7 +65,7 @@ export declare class TraderHelper { * @param item * @returns boolean */ - protected isWeaponAndBelowTraderBuyDurability(traderID: string, item: Item): boolean; + protected isWeaponBelowTraderBuyDurability(traderID: string, item: Item): boolean; /** * Get the price of an item and all of its attached children * Take into account bonuses/adjsutments e.g. discounts @@ -97,6 +99,17 @@ export declare class TraderHelper { * @param sessionID session id */ lvlUp(traderID: string, sessionID: string): void; + /** + * Get the next update timestamp for a trader + * @param traderID Trader to look up update value for + * @returns future timestamp + */ + getNextUpdateTimestamp(traderID: string): number; + /** + * Get the reset time between trader assort refreshes in seconds + * @param traderId Trader to look up + * @returns Time in seconds + */ getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader diff --git a/Live/CWX_WeatherPatcher/server/dist/types/loaders/PreAkiModLoader.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/loaders/PreAkiModLoader.d.ts index 6ded3c6..4ab1689 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/loaders/PreAkiModLoader.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/loaders/PreAkiModLoader.d.ts @@ -33,9 +33,20 @@ export declare class PreAkiModLoader implements IModLoader { protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; /** - * - * @param mods Get an array of broken/invalid mods by name - * @returns Mod names array + * Check for duplciate mods loaded, show error if duplicate mod found + * @param modPackageData dictionary of mod package.json data + */ + protected checkForDuplicateMods(modPackageData: Record): void; + /** + * Check for and return duplicate strings inside an array + * @param stringArray Array to check for duplicates + * @returns string array of duplicates, empty if none found + */ + protected getDuplicates(stringArray: string[]): string[]; + /** + * Get an array of mods with errors that prevent them from working with SPT + * @param mods mods to validate + * @returns Mod names as array */ protected getBrokenMods(mods: string[]): string[]; /** @@ -57,7 +68,12 @@ export declare class PreAkiModLoader implements IModLoader { protected addMod(mod: string): Promise; protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record): boolean; protected isModCompatible(mod: IPackageJsonData, loadedMods: Record): boolean; - protected validMod(mod: string): boolean; + /** + * Validate a mod passes a number of checks + * @param modName name of mod in /mods/ to validate + * @returns true if valid + */ + protected validMod(modName: string): boolean; protected getLoadOrderRecursive(mod: string, result: Record, visited: Record): void; protected getLoadOrder(mods: Record): Record; getContainer(): DependencyContainer; diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/eft/common/IGlobals.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/eft/common/IGlobals.d.ts index 9d28dbc..81e2023 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/models/eft/common/IGlobals.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/eft/common/IGlobals.d.ts @@ -1175,5 +1175,6 @@ export interface Preset { _name: string; _parent: string; _items: Item[]; + /** Default presets have this property */ _encyclopedia?: string; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/eft/common/ILocationBase.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/eft/common/ILocationBase.d.ts index b1dd448..78ade9a 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/models/eft/common/ILocationBase.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/eft/common/ILocationBase.d.ts @@ -137,7 +137,7 @@ export interface BotLocationModifier { VisibleDistance: number; } export interface MinMaxBot { - WildSpawnType: string; + WildSpawnType: WildSpawnType; max: number; min: number; } @@ -195,7 +195,7 @@ export interface Wave { BotPreset: string; BotSide: string; SpawnPoints: string; - WildSpawnType: string; + WildSpawnType: WildSpawnType; isPlayers: boolean; number: number; slots_max: number; @@ -203,3 +203,7 @@ export interface Wave { time_max: number; time_min: number; } +export declare enum WildSpawnType { + ASSAULT = "assault", + MARKSMAN = "marksman" +} diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/eft/common/tables/IBotBase.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/eft/common/tables/IBotBase.d.ts index 0ee468e..25cb861 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/models/eft/common/tables/IBotBase.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/eft/common/tables/IBotBase.d.ts @@ -28,6 +28,8 @@ export interface IBotBase { CarExtractCounts: CarExtractCounts; SurvivorClass: SurvivorClass; WishList: string[]; + /** SPT specific property used during bot generation in raid */ + sptIsPmc?: boolean; } export interface Info { EntryPoint: string; @@ -66,13 +68,13 @@ export interface IBan { dateTime: number; } export declare enum BanType { - Chat = 0, - RagFair = 1, - Voip = 2, - Trading = 3, - Online = 4, - Friends = 5, - ChangeNickname = 6 + CHAT = 0, + RAGFAIR = 1, + VOIP = 2, + TRADING = 3, + ONLINE = 4, + FRIENDS = 5, + CHANGE_NICKNAME = 6 } export interface Customization { Head: string; @@ -312,11 +314,11 @@ export interface Notes { export interface CarExtractCounts { } export declare enum SurvivorClass { - Unknown = 0, - Neutralizer = 1, - Marauder = 2, - Paramedic = 3, - Survivor = 4 + UNKNOWN = 0, + NEUTRALIZER = 1, + MARAUDER = 2, + PARAMEDIC = 3, + SURVIVOR = 4 } export interface Quest { qid: string; diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/eft/common/tables/ITemplateItem.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/eft/common/tables/ITemplateItem.d.ts index 23a1a14..8569e61 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/eft/common/tables/ITemplateItem.d.ts @@ -34,6 +34,7 @@ export interface Props { LootExperience?: number; ExamineExperience?: number; HideEntrails?: boolean; + InsuranceDisabled?: boolean; RepairCost?: number; RepairSpeed?: number; ExtraSizeLeft?: number; @@ -79,7 +80,7 @@ export interface Props { HasShoulderContact?: boolean; SightingRange?: number; DoubleActionAccuracyPenaltyMult?: number; - ModesCount: any; + ModesCount?: any; DurabilityBurnModificator?: number; HeatFactor?: number; CoolFactor?: number; @@ -155,7 +156,7 @@ export interface Props { RigLayoutName?: string; MaxDurability?: number; armorZone?: string[]; - armorClass: any; + armorClass?: any; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -206,6 +207,7 @@ export interface Props { IsOneoff?: boolean; MustBoltBeOpennedForExternalReload?: boolean; MustBoltBeOpennedForInternalReload?: boolean; + NoFiremodeOnBoltcatch?: boolean; BoltAction?: boolean; HipAccuracyRestorationDelay?: number; HipAccuracyRestorationSpeed?: number; @@ -252,8 +254,8 @@ export interface Props { foodUseTime?: number; foodEffectType?: string; StimulatorBuffs?: string; - effects_health: any; - effects_damage: any; + effects_health?: any; + effects_damage?: any; MaximumNumberOfUsage?: number; knifeHitDelay?: number; knifeHitSlashRate?: number; diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/eft/common/tables/ITrader.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/eft/common/tables/ITrader.d.ts index f0fe2b5..37b2d61 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/models/eft/common/tables/ITrader.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/eft/common/tables/ITrader.d.ts @@ -7,7 +7,7 @@ export interface ITrader { suits?: ISuit[]; } export interface ITraderBase { - refreshAssort: boolean; + refreshTraderRagfairOffers: boolean; _id: string; avatar: string; balance_dol: number; @@ -58,7 +58,7 @@ export interface Repair { quality: string; } export interface ITraderAssort { - nextResupply?: number; + nextResupply: number; items: Item[]; barter_scheme: Record; loyal_level_items: Record; @@ -67,6 +67,7 @@ export interface IBarterScheme { count: number; _tpl: string; onlyFunctional?: boolean; + sptQuestLocked?: boolean; } export interface ISuit { _id: string; diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/eft/health/Effect.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/eft/health/Effect.d.ts index 2f0adac..7eb3ffc 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/models/eft/health/Effect.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/eft/health/Effect.d.ts @@ -1,5 +1,5 @@ export declare enum Effect { - Fracture = "Fracture", - LightBleeding = "LightBleeding", - HeavyBleeding = "HeavyBleeding" + FRACTURE = "Fracture", + LIGHT_BLEEDING = "LightBleeding", + HEAVY_BLEEDING = "HeavyBleeding" } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/eft/health/IOffraidHealRequestData.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/eft/health/IOffraidHealRequestData.d.ts index c242300..26b02bd 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/models/eft/health/IOffraidHealRequestData.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/eft/health/IOffraidHealRequestData.d.ts @@ -7,12 +7,12 @@ export interface IOffraidHealRequestData extends IBaseInteractionRequestData { time: number; } export declare enum BodyPart { - Head = 0, - Chest = 1, - Stomach = 2, - LeftArm = 3, - RightArm = 4, - LeftLeg = 5, - RightLeg = 6, - Common = 7 + HEAD = "Head", + CHEST = "Chest", + STOMACH = "Stomach", + LEFT_ARM = "LeftArm", + RIGHT_ARM = "RightArm", + LEFT_LEG = "LeftLeg", + RIGHT_LEG = "RightLeg", + COMMON = "Common" } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/eft/notifier/INotifier.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/eft/notifier/INotifier.d.ts index 8c48260..b248636 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/models/eft/notifier/INotifier.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/eft/notifier/INotifier.d.ts @@ -1,9 +1,9 @@ export interface INotifierChannel { - "server": string; - "channel_id": string; - "url": string; - "notifierServer": string; - "ws": string; + server: string; + channel_id: string; + url: string; + notifierServer: string; + ws: string; } import { Message } from "../profile/IAkiProfile"; export interface INotification { diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/eft/ragfair/IRagfairOffer.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/eft/ragfair/IRagfairOffer.d.ts index 63f655e..141b605 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -15,6 +15,8 @@ export interface IRagfairOffer { name?: string; shortName?: string; loyaltyLevel: number; + buyRestrictionMax?: number; + buyRestrictionCurrent?: number; locked: boolean; unlimitedCount: boolean; summaryCost: number; diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/enums/AmmoTypes.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/enums/AmmoTypes.d.ts index b52ddcf..254b410 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/models/enums/AmmoTypes.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/enums/AmmoTypes.d.ts @@ -23,7 +23,7 @@ export declare enum Ammo762x54 { BT_GZH = "5e023d34e8a400319a28ed44", BS_GZH = "5e023d48186a883be655e551" } -export declare enum Ammo338Lapua { +export declare enum Ammo86x70 { TAC_X = "5fc382b6d6fa9c00c571bbc3", UCW = "5fc382c1016cce60e8341b20", AP = "5fc382a9d724d907e2077dab", @@ -85,13 +85,13 @@ export declare enum Ammo9x21 { PE_GZH = "5a26ac06c4a282000c5a90a8", BT_GZH = "5a26ac0ec4a28200741e1e18" } -export declare enum Ammo357Mag { +export declare enum Ammo9x33R { FMJ = "62330b3ed4dc74626d570b95", HOLLOW_POINT = "62330bfadc5883093563729b", SOFT_POINT = "62330c40bdd19b369e1e53d1", JACKET_HP = "62330c18744e5e31df12f516" } -export declare enum Ammo45ACP { +export declare enum Ammo1143x23ACP { MATCH_FMJ = "5e81f423763d9f754677bf2e", HYDRA_SHOK = "5efb0fc6aeb21837e749c801", LASERMATCH_FMJ = "5efb0d4f4bc50b58e81710f3", @@ -126,7 +126,7 @@ export declare enum Ammo556x45 { MK_318_MOD_0_SOST = "60194943740c5d77f6705eea", SSA_AP = "601949593ae8f707c4608daa" } -export declare enum Ammo300Blackout { +export declare enum Ammo762x35 { M62_TRACER = "619636be6db0f2477964e710", BCP_FMJ = "5fbe3ffdf8b6a877a729ea82", AP = "5fd20ff893a8961fc660a954", diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/enums/BaseClasses.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/enums/BaseClasses.d.ts index e733bca..36ebc71 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/models/enums/BaseClasses.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/enums/BaseClasses.d.ts @@ -25,6 +25,7 @@ export declare enum BaseClasses { SIGHTS = "5448fe7a4bdc2d6f028b456b", MEDS = "543be5664bdc2dd4348b4569", MONEY = "543be5dd4bdc2deb348b4569", + NIGHTVISION = "5a2c3a9486f774688b05e574", KEY = "543be5e94bdc2df1348b4568", KEY_MECHANICAL = "5c99f98d86f7745c314214b3", KEYCARD = "5c164d2286f774194c5e69fa", @@ -66,8 +67,8 @@ export declare enum BaseClasses { LUBRICANT = "57864e4c24597754843f8723", BATTERY = "57864ee62459775490116fc1", ASSAULT_SCOPE = "55818add4bdc2d5b648b456f", - REFLEX_SIGHT = "55818ad54bdc2ddc698b4569", TACTICAL_COMBO = "55818b164bdc2ddc698b456c", + FLASHLIGHT = "55818b084bdc2d5b648b4571", MAGAZINE = "5448bc234bdc2d3c308b4569", LIGHT_LASER = "55818b0e4bdc2dde698b456e", FLASH_HIDER = "550aa4bf4bdc2dd6348b456b", diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/enums/BotAmount.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/enums/BotAmount.d.ts index d0e1df1..9ef9cab 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/models/enums/BotAmount.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/enums/BotAmount.d.ts @@ -1,7 +1,7 @@ export declare enum BotAmount { - AsOnline = "AsOnline", - Low = "Low", - Medium = "Medium", - High = "High", - Horde = "Horde" + AS_ONLINE = "AsOnline", + LOW = "Low", + MEDIUM = "Medium", + HIGH = "High", + HORDE = "Horde" } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/enums/BotDifficulty.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/enums/BotDifficulty.d.ts index c901bcf..80e45ad 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/models/enums/BotDifficulty.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/enums/BotDifficulty.d.ts @@ -1,8 +1,8 @@ export declare enum BotDifficulty { - AsOnline = "AsOnline", - Easy = "Easy", - Medium = "Medium", - Hard = "Hard", - Impossible = "Impossible", - Random = "Random" + AS_ONLINE = "AsOnline", + EASY = "Easy", + MEDIUM = "Medium", + HARD = "Hard", + IMPOSSIBLE = "Impossible", + RANDOM = "Random" } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/enums/ConfigTypes.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/enums/ConfigTypes.d.ts index 61d6f99..468ece5 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/models/enums/ConfigTypes.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/enums/ConfigTypes.d.ts @@ -8,6 +8,7 @@ export declare enum ConfigTypes { IN_RAID = "aki-inraid", INSURANCE = "aki-insurance", INVENTORY = "aki-inventory", + ITEM = "aki-item", LOCALE = "aki-locale", LOCATION = "aki-location", MATCH = "aki-match", diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/enums/ELocationName.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/enums/ELocationName.d.ts index b56cc08..7ae7caa 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/models/enums/ELocationName.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/enums/ELocationName.d.ts @@ -1,5 +1,6 @@ export declare enum ELocationName { FACTORY_DAY = "factory4_day", + FACTORY_NIGHT = "factory4_night", BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/enums/MemberCategory.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/enums/MemberCategory.d.ts index 3bd9a21..a81380e 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/models/enums/MemberCategory.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/enums/MemberCategory.d.ts @@ -1,13 +1,13 @@ export declare enum MemberCategory { - Default = 0, - Developer = 1, - UniqueId = 2, - Trader = 4, - Group = 8, - System = 16, - ChatModerator = 32, - ChatModeratorWithPermanentBan = 64, - UnitTest = 128, - Sherpa = 256, - Emissary = 512 + DEFAULT = 0, + DEVELOPER = 1, + UNIQUE_ID = 2, + TRADER = 4, + GROUP = 8, + SYSTEM = 16, + CHAT_MODERATOR = 32, + CHAT_MODERATOR_WITH_PERMANENT_BAN = 64, + UNIT_TEST = 128, + SHERPA = 256, + EMISSARY = 512 } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/enums/QuestRewardType.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/enums/QuestRewardType.d.ts index 1d3db86..16f7e39 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/models/enums/QuestRewardType.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/enums/QuestRewardType.d.ts @@ -1,8 +1,8 @@ export declare enum QuestRewardType { - Skill = "Skill", - Experience = "Experience", - TraderStanding = "TraderStanding", - TraderUnlock = "TraderUnlock", - Item = "Item", - AssortmentUnlock = "AssortmentUnlock" + SKILL = "Skill", + EXPERIENCE = "Experience", + TRADER_STANDING = "TraderStanding", + TRADER_UNLOCK = "TraderUnlock", + ITEM = "Item", + ASSORTMENT_UNLOCK = "AssortmentUnlock" } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/enums/RaidMode.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/enums/RaidMode.d.ts index c5a8cff..e20cf3f 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/models/enums/RaidMode.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/enums/RaidMode.d.ts @@ -1,5 +1,5 @@ export declare enum RaidMode { - Online = "Online", - Local = "Local", - Coop = "Coop" + ONLINE = "Online", + LOCAL = "Local", + COOP = "Coop" } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/enums/WeaponTypes.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/enums/WeaponTypes.d.ts new file mode 100644 index 0000000..867b052 --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/enums/WeaponTypes.d.ts @@ -0,0 +1,151 @@ +export declare enum Weapons127x55 { + ASH_12 = "5cadfbf7ae92152ac412eeef" +} +export declare enum Weapons86x70 { + MK_18 = "5fc22d7c187fea44d52eda44", + AXMC = "627e14b21713922ded6f2c15" +} +export declare enum Weapons9x39 { + AS_VAL = "57c44b372459772d2b39b8ce", + VSS_VINTOREZ = "57838ad32459774a17445cd2" +} +export declare enum Weapons762x54R { + SVDS = "5c46fbd72e2216398b5a8c9c", + MP_18 = "61f7c9e189e6fb1a5e3ea78d", + MOSIN_INFANTRY = "5bfd297f0db834001a669119", + MOSIN_SNIPER = "5ae08f0a5acfc408fb1398a1", + SV_98 = "55801eed4bdc2d89578b4588" +} +export declare enum Weapons762x51 { + VPO_101 = "5c501a4d2e221602b412b540", + DT_MDR_762 = "5dcbd56fdbd3d91b3e5468d5", + SA_58 = "5b0bbe4e5acfc40dc528a72d", + SCARH_BLACK = "6183afd850224f204c1da514", + SCARH_FDE = "6165ac306ef05c2ce828ef74", + HK_G28 = "6176aca650224f204c1da3fb", + M1A = "5aafa857e5b5b00018480968", + RFB = "5f2a9575926fd9352339381f", + RSASS = "5a367e5dc4a282000e49738f", + SR_25 = "5df8ce05b11454561e39243b", + DVL_10 = "588892092459774ac91d4b11", + M700 = "5bfea6e90db834001b7347f3", + T5000M = "5df24cf80dee1b22f862e9bc" +} +export declare enum Weapons366TKM { + VPO_209 = "59e6687d86f77411d949b251", + VPO_215 = "5de652c31b7e3716273428be" +} +export declare enum Weapons762x39 { + OP_SKS = "587e02ff24597743df3deaeb", + SKS = "574d967124597745970e7c94", + AK_103 = "5ac66d2e5acfc43b321d4b53", + AK_104 = "5ac66d725acfc43b321d4b60", + AKM = "59d6088586f774275f37482f", + AKMN = "5a0ec13bfcdbcb00165aa685", + AKMS = "59ff346386f77477562ff5e2", + AKMSN = "5abcbc27d8ce8700182eceeb", + MK47_MUTANT = "606587252535c57a13424cfd", + RD_704 = "628a60ae6b1d481ff772e9c8", + VPO_136 = "59e6152586f77473dc057aa1" +} +export declare enum Weapons762x35 { + MCX = "5fbcc1d9016cce60e8341ab3" +} +export declare enum Weapons556x45 { + ADAR_2_15 = "5c07c60e0db834002330051f", + AK_101 = "5ac66cb05acfc40198510a10", + AK_102 = "5ac66d015acfc400180ae6e4", + DT_MDR_556 = "5c488a752e221602b412af63", + HK_416A5 = "5bb2475ed4351e00853264e3", + HK_G36 = "623063e994fc3f7b302a9696", + M4A1 = "5447a9cd4bdc2dbd208b4567", + SCARL_BLACK = "6184055050224f204c1da540", + SCARL_FDE = "618428466ef05c2ce828f218", + TX15_DML = "5d43021ca4b9362eab4b5e25" +} +export declare enum Weapons545x39 { + AK_105 = "5ac66d9b5acfc4001633997a", + AK_74 = "5bf3e03b0db834001d2c4a9c", + AK_74M = "5ac4cd105acfc40016339859", + AK_74N = "5644bd2b4bdc2d3b4c8b4572", + AKS_74 = "5bf3e0490db83400196199af", + AKS_74N = "5ab8e9fcd8ce870019439434", + AKS_74U = "57dc2fa62459775949412633", + AKS_74UB = "5839a40f24597726f856b511", + AKS_74UN = "583990e32459771419544dd2", + SAG_AK = "628b5638ad252a16da6dd245", + SAG_AK_SHORT = "628b9c37a733087d0d7fe84b", + RPK_16 = "5beed0f50db834001c062b12" +} +export declare enum Weapons57x28FN { + FN_57_BLACK = "5d3eb3b0a4b93615055e84d2", + FN_57_FDE = "5d67abc1a4b93614ec50137f", + FN_P90 = "5cc82d76e24e8d00134b4b83" +} +export declare enum Weapons46x30HK { + MP7A1 = "5ba26383d4351e00334c93d9", + MP7A2 = "5bd70322209c4d00d7167b8f" +} +export declare enum Weapons1143x23 { + M1911A1 = "5e81c3cbac2bb513793cdc75", + M45A1 = "5f36a0e5fbf956000b716b65", + USP45 = "6193a720f8ee7e52e42109ed", + UMP45 = "5fc3e272f8b6a877a729eac5", + VECTOR45 = "5fb64bc92b1b027b1f50bcf2" +} +export declare enum Weapons9x33R { + CR_50DS = "61a4c8884f95bc3b2c5dc96f" +} +export declare enum Weapons9x21 { + SR_1MP = "59f98b4986f7746f546d2cef" +} +export declare enum Weapons9x19 { + GLOCK_17 = "5a7ae0c351dfba0017554310", + GLOCK_18C = "5b1fa9b25acfc40018633c01", + M9A3 = "5cadc190ae921500103bb3b6", + MP_443 = "576a581d2459771e7b1bc4f1", + P226R = "56d59856d2720bd8418b456a", + PL_15 = "602a9740da11d6478d5a06dc", + CR_200DS = "624c2e8614da335f1e034d8c", + MP5 = "5926bb2186f7744b1c6c6e60", + MP5K = "5d2f0d8048f0356c925bc3b0", + MP9 = "5e00903ae9dc277128008b87", + MP9_N = "5de7bd7bfd6b4e6e2276dc25", + MPX = "58948c8e86f77409493f7266", + PP_19_01 = "59984ab886f7743e98271174", + SAIGA_9 = "59f9cabd86f7743a10721f46", + STM_9 = "60339954d62c9b14ed777c06", + VECTOR_9MM = "5fc3f2d5900b1d5091531e57" +} +export declare enum Weapons9x18 { + APB = "5abccb7dd8ce87001773e277", + APS = "5a17f98cfcdbcb0980087290", + PB_SILENCED = "56e0598dd2720bb5668b45a6", + PM = "5448bd6b4bdc2dfc2f8b4569", + PM_T = "579204f224597773d619e051", + PP9_KLIN = "57f4c844245977379d5c14d1", + PP91_KEDR = "57d14d2524597714373db789", + PP91_KEDRB = "57f3c6bd24597738e730fa2f" +} +export declare enum Weapons762x25 { + TT = "571a12c42459771f627b58a0", + TT_GOLD = "5b3b713c5acfc4330140bd8d", + PPSH_41 = "5ea03f7400685063ec28bfa8" +} +export declare enum Weapons12Gauge { + M3_SUPER90 = "6259b864ebedf17603599e88", + M590A1 = "5e870397991fd70db46995c8", + M870 = "5a7828548dc32e5a9c28b516", + MP_133 = "54491c4f4bdc2db1078b4568", + MP_153 = "56dee2bdd2720bc8328b4567", + MP_155 = "606dae0ab0e443224b421bb7", + MP_43_1C = "5580223e4bdc2d1c128b457f", + MTS_255_12 = "60db29ce99594040e04c4a27", + SAIGA_12GA = "576165642459773c7a400233" +} +export declare enum Weapons20Gauge { + TOZ_106 = "5a38e6bac4a2826c6e06d79b" +} +export declare enum Weapons23x75 { + KS_23M = "5e848cc2988a8701445df1e8" +} diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/spt/bots/BotLootCache.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/bots/BotLootCache.d.ts index e185315..aedf7b0 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/models/spt/bots/BotLootCache.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/bots/BotLootCache.d.ts @@ -11,13 +11,13 @@ export declare class BotLootCache { grenadeItems: ITemplateItem[]; } export declare enum LootCacheType { - Special = "Special", - Backpack = "Backpack", - Pocket = "Pocket", - Vest = "Vest", - Combined = "Combined", - HealingItems = "HealingItems", - DrugItems = "DrugItems", - StimItems = "StimItems", - GrenadeItems = "GrenadeItems" + SPECIAL = "Special", + BACKPACK = "Backpack", + POCKET = "Pocket", + VEST = "Vest", + COMBINED = "Combined", + HEALING_ITEMS = "HealingItems", + DRUG_ITEMS = "DrugItems", + STIM_ITEMS = "StimItems", + GRENADE_ITEMS = "GrenadeItems" } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/IAirdropConfig.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/IAirdropConfig.d.ts index f4aee89..3edcbdd 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/IAirdropConfig.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/IAirdropConfig.d.ts @@ -1,14 +1,14 @@ +import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IAirdropConfig extends IBaseConfig { kind: "aki-airdrop"; airdropChancePercent: AirdropChancePercent; - airdropMinOpenHeight: number; - airdropMaxOpenHeight: number; planeMinFlyHeight: number; planeMaxFlyHeight: number; planeVolume: number; airdropMinStartTimeSeconds: number; airdropMaxStartTimeSeconds: number; + loot: AirdropLoot; } export interface AirdropChancePercent { bigmap: number; @@ -18,3 +18,13 @@ export interface AirdropChancePercent { interchange: number; reserve: number; } +export interface AirdropLoot { + presetCount: MinMax; + itemCount: MinMax; + itemBlacklist: string[]; + itemTypeWhitelist: string[]; + /** key: item base type: value: max count */ + itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; +} diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/IBotConfig.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/IBotConfig.d.ts index e171087..af8ceba 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/IBotConfig.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/IBotConfig.d.ts @@ -1,17 +1,31 @@ import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; +import { IBotDurability } from "./IBotDurability"; +import { IPmcConfig } from "./IPmcConfig"; export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; + /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** What bot types should be classified as bosses */ bosses: string[]; - durability: Durability; + /** Control weapon/armor durability min/max values for each bot type */ + durability: IBotDurability; + /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ lootNValue: LootNvalue; + /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; - pmc: PmcConfig; + /** PMC bot specific config settings */ + pmc: IPmcConfig; + /** Control how many items are allowed to spawn on a bot + * key: bottype, value: */ itemSpawnLimits: Record>; - equipment: Record; + /** Blacklist/whitelist items on a bot */ + equipment: Record; + /** Show a bots botType value after their name */ showTypeInNickname: boolean; - maxBotCap: number; + /** Max number of bots that can be spawned in a raid at any one time */ + maxBotCap: Record; + /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; } export interface PresetBatch { @@ -44,79 +58,23 @@ export interface PresetBatch { test: number; exUsec: number; } -export interface Durability { - default: DefaultDurability; - pmc: PmcDurability; - boss: BotDurability; - follower: BotDurability; - assault: BotDurability; - cursedassault: BotDurability; - marksman: BotDurability; - pmcbot: BotDurability; - exusec: BotDurability; - sectantpriest: BotDurability; - sectantwarrior: BotDurability; -} -export interface DefaultDurability { - armor: DefaultArmor; - weapon: WeaponDurability; -} -export interface DefaultArmor { - maxDelta: number; - minDelta: number; -} -export interface WeaponDurability { - lowestMax: number; - highestMax: number; - maxDelta: number; - minDelta: number; -} -export interface PmcDurability { - armor: PmcDurabilityArmor; - weapon: WeaponDurability; -} -export interface PmcDurabilityArmor { - lowestMaxPercent: number; - highestMaxPercent: number; - maxDelta: number; - minDelta: number; -} -export interface BotDurability { - armor: ArmorDurability; - weapon: WeaponDurability; -} -export interface ArmorDurability { - maxDelta: number; - minDelta: number; -} export interface LootNvalue { scav: number; pmc: number; } -export interface PmcConfig { - dynamicLoot: PmcDynamicLoot; - difficulty: string; - looseWeaponInBackpackChancePercent: number; - looseWeaponInBackpackLootMinMax: MinMax; - isUsec: number; - chanceSameSideIsHostilePercent: number; - usecType: string; - bearType: string; - maxBackpackLootTotalRub: number; - maxPocketLootTotalRub: number; - maxVestLootTotalRub: number; - convertIntoPmcChance: Record; - enemyTypes: string[]; -} -export interface PmcDynamicLoot { - whitelist: string[]; - blacklist: string[]; - moneyStackLimits: Record; -} -export interface Equipment { +export interface EquipmentFilters { + weaponModLimits: ModLimits; + randomisedWeaponModSlots?: string[]; + randomisedArmorSlots?: string[]; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; } +export interface ModLimits { + /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ + scopeLimit?: number; + /** How many lasers or lights are allowed on a weapon - hard coded to work with TACTICAL_COMBO, and FLASHLIGHT */ + lightLaserLimit?: number; +} export interface EquipmentFilterDetails { levelRange: MinMax; equipment: Record; diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/IBotDurability.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/IBotDurability.d.ts new file mode 100644 index 0000000..38a47cc --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/IBotDurability.d.ts @@ -0,0 +1,47 @@ +export interface IBotDurability { + default: DefaultDurability; + pmc: PmcDurability; + boss: BotDurability; + follower: BotDurability; + assault: BotDurability; + cursedassault: BotDurability; + marksman: BotDurability; + pmcbot: BotDurability; + exusec: BotDurability; + gifter: BotDurability; + sectantpriest: BotDurability; + sectantwarrior: BotDurability; +} +/** Durability values to be used when a more specific bot type cant be found */ +export interface DefaultDurability { + armor: DefaultArmor; + weapon: WeaponDurability; +} +export interface DefaultArmor { + maxDelta: number; + minDelta: number; +} +export interface WeaponDurability { + lowestMax: number; + highestMax: number; + maxDelta: number; + minDelta: number; +} +export interface PmcDurability { + armor: PmcDurabilityArmor; + weapon: WeaponDurability; +} +export interface PmcDurabilityArmor { + lowestMaxPercent: number; + highestMaxPercent: number; + maxDelta: number; + minDelta: number; +} +export interface BotDurability { + armor: ArmorDurability; + weapon: WeaponDurability; +} +export interface ArmorDurability { + maxDelta: number; + minDelta: number; +} diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/IHideoutConfig.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/IHideoutConfig.d.ts index 36d6246..f232052 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/IHideoutConfig.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/IHideoutConfig.d.ts @@ -2,6 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; runIntervalSeconds: number; - fuelDrainRateMultipler: number; hoursForSkillCrafting: number; + generatorSpeedWithoutFuel: number; + generatorFuelFlowRate: number; + airFilterUnitFlowRate: number; + /** SEE HIDEOUTHELPER BEFORE CHANGING CONFIG */ + gpuBoostRate: number; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/IItemConfig.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/IItemConfig.d.ts new file mode 100644 index 0000000..5ecccc2 --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/IItemConfig.d.ts @@ -0,0 +1,5 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface IItemConfig extends IBaseConfig { + kind: "aki-item"; + blacklist: string[]; +} diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/IPmcConfig.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/IPmcConfig.d.ts new file mode 100644 index 0000000..9db2ba1 --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/IPmcConfig.d.ts @@ -0,0 +1,26 @@ +import { MinMax } from "../../common/MinMax"; +export interface IPmcConfig { + dynamicLoot: DynamicLoot; + useDifficultyOverride: boolean; + difficulty: string; + looseWeaponInBackpackChancePercent: number; + looseWeaponInBackpackLootMinMax: MinMax; + isUsec: number; + chanceSameSideIsHostilePercent: number; + /** key: location, value: type for usec/bear */ + pmcType: Record; + maxBackpackLootTotalRub: number; + maxPocketLootTotalRub: number; + maxVestLootTotalRub: number; + convertIntoPmcChance: Record; + enemyTypes: string[]; +} +export interface PmcTypes { + usec: string; + bear: string; +} +export interface DynamicLoot { + whitelist: string[]; + blacklist: string[]; + moneyStackLimits: Record; +} diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/IQuestConfig.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/IQuestConfig.d.ts index be4a97b..45c9aae 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/IQuestConfig.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/IQuestConfig.d.ts @@ -4,6 +4,8 @@ export interface IQuestConfig extends IBaseConfig { kind: "aki-quest"; redeemTime: number; repeatableQuests: IRepeatableQuestConfig[]; + bearOnlyQuests: string[]; + usecOnlyQuests: string[]; } export interface IRepeatableQuestConfig { name: string; @@ -15,6 +17,10 @@ export interface IRepeatableQuestConfig { locations: Record; traderWhitelist: ITraderWhitelist[]; questConfig: IQuestConfig; + /** Item base types to block when generating rewards */ + rewardBaseTypeBlacklist: string[]; + /** Item tplIds to ignore when generating rewards */ + rewardBlacklist: string[]; } export interface IRewardScaling { levels: number[]; diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/IRagfairConfig.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/IRagfairConfig.d.ts index c24e617..c1b8763 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/IRagfairConfig.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/IRagfairConfig.d.ts @@ -12,6 +12,7 @@ export interface Sell { chance: Chance; time: Time; reputation: Reputation; + simulatedSellHours: number; } export interface Chance { base: number; @@ -27,11 +28,18 @@ export interface Reputation { gain: number; loss: number; } +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Dynamic { + offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; price: MinMax; presetPrice: MinMax; + showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; condition: Condition; stackablePercent: MinMax; diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/ITraderConfig.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/ITraderConfig.d.ts index c8e8044..6b1c1e3 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/ITraderConfig.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/config/ITraderConfig.d.ts @@ -12,8 +12,10 @@ export interface UpdateTime { seconds: number; } export interface FenceConfig { + partialRefreshTimeSeconds: number; + partialRefreshChangePercent: number; assortSize: number; - maxPresetsCount: number; + maxPresetsPercent: number; presetPriceMult: number; blacklist: string[]; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/spt/location/AirDropLootItem.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/location/AirDropLootItem.d.ts new file mode 100644 index 0000000..da791ff --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/location/AirDropLootItem.d.ts @@ -0,0 +1,6 @@ +export declare class AirDropLootItem { + id: string; + tpl: string; + isPreset: boolean; + stackCount: number; +} diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/spt/logging/LogBackgroundColor.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/logging/LogBackgroundColor.d.ts index 87e08a9..1dd369b 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/models/spt/logging/LogBackgroundColor.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/logging/LogBackgroundColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogBackgroundColor { - default = "", - black = "blackBG", - red = "redBG", - green = "greenBG", - yellow = "yellowBG", - blue = "blueBG", - magenta = "magentaBG", - cyan = "cyanBG", - white = "whiteBG" + DEFAULT = "", + BLACK = "blackBG", + RED = "redBG", + GREEN = "greenBG", + YELLOW = "yellowBG", + BLUE = "blueBG", + MAGENTA = "magentaBG", + CYAN = "cyanBG", + WHITE = "whiteBG" } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/spt/logging/LogTextColor.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/logging/LogTextColor.d.ts index 7147ae3..6c7abf3 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/models/spt/logging/LogTextColor.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/logging/LogTextColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogTextColor { - black = "black", - red = "red", - green = "green", - yellow = "yellow", - blue = "blue", - magenta = "magenta", - cyan = "cyan", - white = "white", - gray = "" + BLACK = "black", + RED = "red", + GREEN = "green", + YELLOW = "yellow", + BLUE = "blue", + MAGENTA = "magenta", + CYAN = "cyan", + WHITE = "white", + GRAY = "" } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/spt/server/ILocaleBase.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/server/ILocaleBase.d.ts index 8887c06..6e20b89 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/models/spt/server/ILocaleBase.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/server/ILocaleBase.d.ts @@ -13,10 +13,10 @@ export interface ILocaleGlobalBase { season: Record; customization: Record; repeatableQuest: Record; - templates: ILocaleTemplateBase; - locations: ILocaleLocationsBase; - banners: ILocaleBannersBase; - trading: ILocaleTradingBase; + templates: Record; + locations: Record; + banners: Record; + trading: Record; } export interface ILocaleQuest { name: string; @@ -31,23 +31,11 @@ export interface ILocaleQuest { export interface ILocalePreset { Name: string; } -export interface ILocaleTemplateBase { - templates: Record; -} -export interface ILocaleLocationsBase { - locations: Record; -} -export interface ILocaleBannersBase { - locations: Record; -} export interface ILocaleProps { Name: string; ShortName: string; Description: string; } -export interface ILocaleTradingBase { - locations: Record; -} export interface ILocaleTradingProps { FullName: string; FirstName: string; diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/spt/services/LootItem.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/services/LootItem.d.ts new file mode 100644 index 0000000..acb7606 --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/services/LootItem.d.ts @@ -0,0 +1,6 @@ +export declare class LootItem { + id?: string; + tpl: string; + isPreset: boolean; + stackCount: number; +} diff --git a/Live/CWX_WeatherPatcher/server/dist/types/models/spt/services/LootRequest.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/services/LootRequest.d.ts new file mode 100644 index 0000000..1da8770 --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/dist/types/models/spt/services/LootRequest.d.ts @@ -0,0 +1,11 @@ +import { MinMax } from "../../common/MinMax"; +export declare class LootRequest { + presetCount: MinMax; + itemCount: MinMax; + itemBlacklist: string[]; + itemTypeWhitelist: string[]; + /** key: item base type: value: max count */ + itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; +} diff --git a/Live/CWX_WeatherPatcher/server/dist/types/servers/DatabaseServer.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/servers/DatabaseServer.d.ts index aa152d0..b3d29e9 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/servers/DatabaseServer.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/servers/DatabaseServer.d.ts @@ -2,5 +2,5 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; export declare class DatabaseServer { protected tableData: IDatabaseTables; getTables(): IDatabaseTables; - setTables(any: any): void; + setTables(tableData: IDatabaseTables): void; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/servers/RagfairServer.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/servers/RagfairServer.d.ts index bc86cdb..c93864b 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/servers/RagfairServer.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/servers/RagfairServer.d.ts @@ -1,4 +1,6 @@ import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { TraderAssortHelper } from "../helpers/TraderAssortHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -12,11 +14,18 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected traderHelper: TraderHelper; + protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, configServer: ConfigServer); + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); load(): void; update(): void; + /** + * Get traders who need to be periodically refreshed + * @returns string array of traders + */ + protected getUpdateableTraders(): string[]; getAllCategories(): Record; getBespokeCategories(offers: IRagfairOffer[]): Record; /** diff --git a/Live/CWX_WeatherPatcher/server/dist/types/services/BotEquipmentFilterService.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/services/BotEquipmentFilterService.d.ts index e49645b..632f961 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/services/BotEquipmentFilterService.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/services/BotEquipmentFilterService.d.ts @@ -1,12 +1,12 @@ import { IBotType } from "../models/eft/common/tables/IBotType"; -import { Equipment, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; protected configServer: ConfigServer; protected botConfig: IBotConfig; - protected botEquipmentFilterlists: Record; + protected botEquipmentFilterlists: Record; constructor(logger: ILogger, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig @@ -22,7 +22,7 @@ export declare class BotEquipmentFilterService { * @param playerLevel Level of the player * @returns EquipmentBlacklistDetails object */ - protected getBotEquipmentBlacklist(botRole: string, playerLevel: number): EquipmentFilterDetails; + getBotEquipmentBlacklist(botRole: string, playerLevel: number): EquipmentFilterDetails; /** * Get the whitelist for a specific bot type that's within the players level * @param botRole Bot type diff --git a/Live/CWX_WeatherPatcher/server/dist/types/services/BotGenerationCacheService.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/services/BotGenerationCacheService.d.ts new file mode 100644 index 0000000..670c583 --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/dist/types/services/BotGenerationCacheService.d.ts @@ -0,0 +1,52 @@ +import { BotHelper } from "../helpers/BotHelper"; +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotGenerationCacheService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected botHelper: BotHelper; + protected storedBots: IBotBase[]; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); + /** + * Store array of bots in cache, shuffle results before storage + * @param botsToStore + */ + storeBots(botsToStore: IBotBase[]): void; + /** + * Find and return a bot based on its role + * Remove bot from internal array so it can't be retreived again + * @param role role to retreive (assault/bossTagilla etc) + * @returns IBotBase object + */ + getBot(role: string): IBotBase[]; + /** + * Find a bot by its index from cache + * @param indexOfBotToReturn index to find bot by + * @returns bot profile + */ + protected getBotFromCache(indexOfBotToReturn: number): IBotBase; + /** + * Remove bot profile by index from cache + * @param indexOfBotToReturn Index of bot profile to remove + */ + protected removeBotFromCache(indexOfBotToReturn: number): void; + /** + * Get index of bot profile that matches criteria + * @param role role of bot we want + * @param getPmc is requested bot a pmc + * @returns index of found bot + */ + protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; + /** + * Remove all cached bot profiles + */ + clearStoredBots(): void; + /** + * Does cache have bots + * @returns true if empty + */ + cacheIsEmpty(): boolean; +} diff --git a/Live/CWX_WeatherPatcher/server/dist/types/services/BotLootCacheService.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/services/BotLootCacheService.d.ts index cc71eee..00ffb9c 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/services/BotLootCacheService.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/services/BotLootCacheService.d.ts @@ -34,6 +34,17 @@ export declare class BotLootCacheService { * @param isPmc Is the bot a PMC (alteres what loot is cached) */ protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; + /** + * Sort a pool of item objects by its flea price + * @param poolToSort pool of items to sort + */ + protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; + /** + * Add unique items into combined pool + * @param combinedItemPool Pool of items to add to + * @param itemsToAdd items to add to combined pool if unique + */ + protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; /** * Ammo/grenades have this property * @param props diff --git a/Live/CWX_WeatherPatcher/server/dist/types/services/FenceService.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/services/FenceService.d.ts index 79058c6..23fbf52 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/services/FenceService.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/services/FenceService.d.ts @@ -11,29 +11,109 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; +import { ItemFilterService } from "./ItemFilterService"; +/** + * Handle actions surrounding Fence + * e.g. generating or refreshing assorts / get next refresh time + */ export declare class FenceService { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); + protected nextMiniRefreshTimestamp: number; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; - getFenceAssorts(): ITraderAssort; - hasExpiredCache(refreshAssort: boolean): boolean; - generateFenceAssortCache(pmcData: IPmcData): void; /** - * Get the fence level the passed in profile has + * Get assorts player can purchase + * Adjust prices based on fence level of player + * @param pmcProfile Player profile + * @returns ITraderAssort + */ + getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Get fence assorts with no price adjustments based on fence rep + * @returns ITraderAssort + */ + getRawFenceAssorts(): ITraderAssort; + /** + * Does fence need to perform a partial refresh because its passed the refresh timer defined in trader.json + * @returns true if it needs a partial refresh + */ + needsPartialRefresh(): boolean; + /** + * Replace a percentage of fence assorts with freshly generated items + */ + performPartialRefresh(): void; + /** + * Increment fence next refresh timestamp by current timestamp + partialRefreshTimeSeconds from config + */ + protected incrementPartialRefreshTime(): void; + /** + * Compare the current fence offer count to what the config wants it to be, + * If value is lower add extra count to value to generate more items to fill gap + * @param existingItemCountToReplace count of items to generate + * @returns number of items to generate + */ + protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + /** + * Choose an item (not mod) at random and remove from assorts + */ + protected removeRandomItemFromAssorts(): void; + /** + * Get an integer rounded count of items to replace based on percentrage from traderConfig value + * @param totalItemCount total item count + * @returns rounded int of items to replace + */ + protected getCountOfItemsToReplace(totalItemCount: number): number; + /** + * Get the count of items fence offers + * @returns number + */ + getOfferCount(): number; + /** + * Create a trader assort for fence + */ + generateFenceAssortCache(): void; + /** + * Create skeleton to hold assort items + * @returns ITraderAssort object + */ + protected createBaseTraderAssortItem(): ITraderAssort; + /** + * Hydrate result parameter object with generated assorts + * @param assortCount Number of assorts to generate + * @param assorts object to add assorts to + */ + protected createAssorts(assortCount: number, assorts: ITraderAssort): void; + /** + * Get the next update timestamp for fence + * @returns future timestamp + */ + getNextFenceUpdateTimestamp(): number; + /** + * Get fence refresh time in seconds + */ + protected getFenceRefreshTime(): number; + /** + * Get fence level the passed in profile has * @param pmcData Player profile - * @returns FenceLevel + * @returns FenceLevel object */ getFenceInfo(pmcData: IPmcData): FenceLevel; + /** + * Remove an assort from fence by id + * @param assortIdToRemove assort id to remove from fence assorts + */ removeFenceOffer(assortIdToRemove: string): void; - updateFenceOffers(pmcData: IPmcData): void; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/services/InsuranceService.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/services/InsuranceService.d.ts index 171bf10..6be8a2f 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/services/InsuranceService.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/services/InsuranceService.d.ts @@ -2,6 +2,7 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { InsuredItem } from "../models/eft/common/tables/IBotBase"; import { Item } from "../models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; @@ -44,8 +45,22 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; + /** + * Store lost gear post-raid inside profile + * @param pmcData player profile to store gear in + * @param offraidData post-raid request object + * @param preRaidGear gear player wore prior to raid + * @param sessionID Session id + */ storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string): void; storeInsuredItemsForReturn(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string): void; - protected addGearToSend(pmcData: IPmcData, insuredItem: any, actualItem: any, sessionID: string): any; + /** + * Add gear item to InsuredItems array in player profile + * @param pmcData profile to store item in + * @param insuredItem Item to store in profile + * @param actualItem item to store + * @param sessionID Session id + */ + protected addGearToSend(pmcData: IPmcData, insuredItem: InsuredItem, actualItem: Item, sessionID: string): void; getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/services/ItemFilterService.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/services/ItemFilterService.d.ts new file mode 100644 index 0000000..c9c8ef3 --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/dist/types/services/ItemFilterService.d.ts @@ -0,0 +1,24 @@ +import { IItemConfig } from "../models/spt/config/IItemConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +/** Centralise the handling of blacklisting items, uses blacklist found in config/item.json */ +export declare class ItemFilterService { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected blacklist: string[]; + protected itemConfig: IItemConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Check if the provided template id is blacklisted in config/item.json + * @param tpl template id + * @returns true if blacklisted + */ + isItemBlacklisted(tpl: string): boolean; + /** + * Return every template id blacklisted in config/item.json + * @returns string array of blacklisted tempalte ids + */ + getBlacklistedItems(): string[]; +} diff --git a/Live/CWX_WeatherPatcher/server/dist/types/services/PmcAiService.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/services/PmcAiService.d.ts new file mode 100644 index 0000000..0690f1f --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/dist/types/services/PmcAiService.d.ts @@ -0,0 +1,27 @@ +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +/** Storing/retreving pmcRoles set at the start of a raid - its done at that point as we know what location the player is heading to */ +export declare class PmcAiService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + protected usecRole: string; + protected bearRole: string; + constructor(logger: ILogger, configServer: ConfigServer); + /** + * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) + * @param pmcSide eft side (usec/bear) + * @returns pmc side as defined in config + */ + getPmcRole(pmcSide: "usec" | "bear" | string): string; + /** + * Set the roles for pmcs + * @param location map location to look up and use as pmc types + */ + setPmcRolesByLocation(location: string): void; + /** + * Clear the saved role from usec/bear PMCs + */ + clearPmcRoles(): void; +} diff --git a/Live/CWX_WeatherPatcher/server/dist/types/services/ProfileFixerService.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/services/ProfileFixerService.d.ts index ed1dec7..9cb5a38 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/services/ProfileFixerService.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/services/ProfileFixerService.d.ts @@ -45,6 +45,11 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to find and remove slots from */ protected removeResourcesFromSlotsInHideoutWithoutLocationIndexValue(pmcProfile: IPmcData): void; + /** + * Hideout slots need to be in a specific order, locationIndex in ascending order + * @param pmcProfile profile to edit + */ + protected reorderHideoutAreasWithResouceInputs(pmcProfile: IPmcData): void; /** * add in objects equal to the number of slots * @param areaType area to check diff --git a/Live/CWX_WeatherPatcher/server/dist/types/services/ProfileSnapshotService.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/services/ProfileSnapshotService.d.ts new file mode 100644 index 0000000..445ffd0 --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/dist/types/services/ProfileSnapshotService.d.ts @@ -0,0 +1,30 @@ +import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { JsonUtil } from "../utils/JsonUtil"; +export declare class ProfileSnapshotService { + protected jsonUtil: JsonUtil; + protected storedProfileSnapshots: Record; + constructor(jsonUtil: JsonUtil); + /** + * Store a profile into an in-memory object + * @param sessionID session id - acts as the key + * @param profile - profile to save + */ + storeProfileSnapshot(sessionID: string, profile: IAkiProfile): void; + /** + * Retreve a stored profile + * @param sessionID key + * @returns A player profile object + */ + getProfileSnapshot(sessionID: string): IAkiProfile; + /** + * Does a profile exists against the provided key + * @param sessionID key + * @returns true if exists + */ + hasProfileSnapshot(sessionID: string): boolean; + /** + * Remove a stored profile by key + * @param sessionID key + */ + clearProfileSnapshot(sessionID: string): void; +} diff --git a/Live/CWX_WeatherPatcher/server/dist/types/services/RagfairOfferService.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/services/RagfairOfferService.d.ts index 7398a8f..f9e3a34 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/services/RagfairOfferService.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/services/RagfairOfferService.d.ts @@ -24,7 +24,6 @@ export declare class RagfairOfferService { protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected toUpdate: Record; protected expiredOffers: Item[]; protected offers: IRagfairOffer[]; protected ragfairConfig: IRagfairConfig; @@ -38,8 +37,6 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; - setTraderUpdateStatus(traderId: string, shouldUpdate: boolean): void; - shouldTraderBeUpdated(traderID: string): boolean; getExpiredOfferCount(): number; /** * Get an array of expired items not yet processed into new offers @@ -53,12 +50,15 @@ export declare class RagfairOfferService { * @returns offer exists - true */ doesOfferExist(offerId: string): boolean; - getTraders(): Record; - flagTraderForUpdate(expiredOfferUserId: string): void; removeOfferById(offerId: string): void; removeOfferStack(offerID: string, amount: number): void; removeAllOffersByTrader(traderId: string): void; - addTradersToUpdateList(): void; + /** + * Do the trader offers on flea need to be refreshed + * @param traderID Trader to check + * @returns true if they do + */ + traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; /** diff --git a/Live/CWX_WeatherPatcher/server/dist/types/services/RagfairPriceService.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/services/RagfairPriceService.d.ts index 679fe1d..466c9e3 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/services/RagfairPriceService.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/services/RagfairPriceService.d.ts @@ -27,6 +27,20 @@ export declare class RagfairPriceService { getDynamicPrice(itemTpl: string): number; getAllFleaPrices(): Record; getFleaPriceForItem(tplId: string): number; + /** + * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * @param itemPrice price of item + * @param itemTpl item template Id being checked + * @returns adjusted price value in roubles + */ + protected adjustPriceIfBelowHandbook(itemPrice: number, itemTpl: string): number; + /** + * Get the percentage difference between two values + * @param a numerical value a + * @param b numerical value b + * @returns different in percent + */ + protected getPriceDifference(a: number, b: number): number; getStaticPriceForItem(tplId: string): number; getBarterPrice(barterScheme: IBarterScheme[]): number; getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; diff --git a/Live/CWX_WeatherPatcher/server/dist/types/services/RepairService.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/services/RepairService.d.ts new file mode 100644 index 0000000..3e6077c --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/dist/types/services/RepairService.d.ts @@ -0,0 +1,75 @@ +import { QuestHelper } from "../helpers/QuestHelper"; +import { RepairHelper } from "../helpers/RepairHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { RepairKitsInfo } from "../models/eft/repair/IRepairActionDataRequest"; +import { RepairItem } from "../models/eft/repair/ITraderRepairActionDataRequest"; +import { IRepairConfig } from "../models/spt/config/IRepairConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ItemEventRouter } from "../routers/ItemEventRouter"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { PaymentService } from "./PaymentService"; +export declare class RepairService { + protected logger: ILogger; + protected itemEventRouter: ItemEventRouter; + protected databaseServer: DatabaseServer; + protected questHelper: QuestHelper; + protected traderHelper: TraderHelper; + protected paymentService: PaymentService; + protected repairHelper: RepairHelper; + protected configServer: ConfigServer; + repairConfig: IRepairConfig; + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + /** + * Use trader to repair an items durability + * @param sessionID Session id + * @param pmcData profile to find item to repair in + * @param repairItemDetails details of the item to repair + * @param traderId Trader being used to repair item + * @returns RepairDetails object + */ + repairItemByTrader(sessionID: string, pmcData: IPmcData, repairItemDetails: RepairItem, traderId: string): RepairDetails; + /** + * + * @param sessionID Session id + * @param pmcData profile to take money from + * @param repairedItemId Repaired item id + * @param repairCost Cost to repair item in roubles + * @param traderId Id of the trader who repaired the item / who is paid + * @param output + */ + payForRepair(sessionID: string, pmcData: IPmcData, repairedItemId: string, repairCost: number, traderId: string, output: IItemEventRouterResponse): void; + /** + * Add skill points to profile after repairing an item + * @param sessionId Session id + * @param repairDetails details of item repaired, cost/item + * @param pmcData Profile to add points to + * @param output IItemEventRouterResponse + */ + addRepairSkillPoints(sessionId: string, repairDetails: RepairDetails, pmcData: IPmcData, output: IItemEventRouterResponse): void; + /** + * + * @param sessionId Session id + * @param pmcData Profile to update repaired item in + * @param repairKits Array of Repair kits to use + * @param itemToRepairId Item id to repair + * @param output IItemEventRouterResponse + * @returns Details of repair, item/price + */ + repairItemByKit(sessionId: string, pmcData: IPmcData, repairKits: RepairKitsInfo[], itemToRepairId: string, output: IItemEventRouterResponse): RepairDetails; + /** + * Update repair kits Resource object if it doesn't exist + * @param repairKitDetails Repair kit details from db + * @param repairKitInInventory Repair kit to update + */ + protected addMaxResourceToKitIfMissing(repairKitDetails: ITemplateItem, repairKitInInventory: Item): void; +} +export declare class RepairDetails { + repairCost?: number; + repairedItem: Item; + repairedItemIsArmor: boolean; +} diff --git a/Live/CWX_WeatherPatcher/server/dist/types/services/TraderAssortService.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/services/TraderAssortService.d.ts index 5ba2d05..03b4e12 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/services/TraderAssortService.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/services/TraderAssortService.d.ts @@ -2,5 +2,10 @@ import { ITraderAssort } from "../models/eft/common/tables/ITrader"; export declare class TraderAssortService { protected pristineTraderAssorts: Record; getPristineTraderAssort(traderId: string): ITraderAssort; + /** + * Store trader assorts inside a class property + * @param traderId Traderid to store assorts against + * @param assort Assorts to store + */ setPristineTraderAssort(traderId: string, assort: ITraderAssort): void; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/utils/HashUtil.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/utils/HashUtil.d.ts index bacbf2a..a8500e1 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/utils/HashUtil.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/utils/HashUtil.d.ts @@ -4,8 +4,18 @@ import { TimeUtil } from "./TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; constructor(timeUtil: TimeUtil); + /** + * Create a 24 character id using the sha256 algorithm + current timestamp + * @returns 24 character hash + */ generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + /** + * Create a hash for the data parameter + * @param algorithm algorithm to use to hash + * @param data data to be hashed + * @returns hash value + */ generateHashForData(algorithm: string, data: crypto.BinaryLike): string; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/utils/RandomUtil.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/utils/RandomUtil.d.ts index c24dd60..633e472 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/utils/RandomUtil.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/utils/RandomUtil.d.ts @@ -136,7 +136,7 @@ export declare class RandomUtil { * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with ot without replacement from the input array + * @param {boolean} replacement Draw with or without replacement from the input array * @return {array} Array consisting of N random elements */ drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; @@ -150,4 +150,10 @@ export declare class RandomUtil { */ drawRandomFromDict(dict: any, count?: number, replacement?: boolean): any[]; getBiasedRandomNumber(min: number, max: number, shift: number, n: number): number; + /** + * Fisher-Yates shuffle an array + * @param array Array to shuffle + * @returns Shuffled array + */ + shuffle(array: Array): Array; } diff --git a/Live/CWX_WeatherPatcher/server/dist/types/utils/TimeUtil.d.ts b/Live/CWX_WeatherPatcher/server/dist/types/utils/TimeUtil.d.ts index eed4e6d..1367e26 100644 --- a/Live/CWX_WeatherPatcher/server/dist/types/utils/TimeUtil.d.ts +++ b/Live/CWX_WeatherPatcher/server/dist/types/utils/TimeUtil.d.ts @@ -1,9 +1,16 @@ +/** + * Utility class to handle time related problems + */ export declare class TimeUtil { static readonly oneHourAsSeconds = 3600; formatTime(date: Date): string; formatDate(date: Date): string; getDate(): string; getTime(): string; + /** + * Get timestamp in seconds + * @returns + */ getTimestamp(): number; /** * mail in eft requires time be in a specific format @@ -15,4 +22,10 @@ export declare class TimeUtil { * @returns current date in format: 00.00.0000 (dd.mm.yyyy) */ getDateMailFormat(): string; + /** + * Convert hours into seconds + * @param hours hours to convert to seconds + * @returns number + */ + getHoursAsSeconds(hours: number): number; } diff --git a/Live/CWX_WeatherPatcher/server/package.json b/Live/CWX_WeatherPatcher/server/package.json index 96ceeed..0a35d7e 100644 --- a/Live/CWX_WeatherPatcher/server/package.json +++ b/Live/CWX_WeatherPatcher/server/package.json @@ -1,10 +1,10 @@ { "name": "WeatherPatcher", "author": "CWX", - "version": "2.4.3", + "version": "2.4.4", "license": "NCSA", "main": "src/mod.js", - "akiVersion": "3.2.2", + "akiVersion": "3.2.3", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" ./**/*.* ./dist", diff --git a/Live/CWX_WeatherPatcher/server/types/callbacks/InsuranceCallbacks.d.ts b/Live/CWX_WeatherPatcher/server/types/callbacks/InsuranceCallbacks.d.ts index 6819960..8835ba2 100644 --- a/Live/CWX_WeatherPatcher/server/types/callbacks/InsuranceCallbacks.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/callbacks/InsuranceCallbacks.d.ts @@ -1,5 +1,5 @@ import { InsuranceController } from "../controllers/InsuranceController"; -import { OnLoadOnUpdate } from "../di/OnLoadOnUpdate"; +import { OnUpdate } from "../di/OnUpdate"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData"; @@ -10,14 +10,13 @@ import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { InsuranceService } from "../services/InsuranceService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -export declare class InsuranceCallbacks extends OnLoadOnUpdate { +export declare class InsuranceCallbacks extends OnUpdate { protected insuranceController: InsuranceController; protected insuranceService: InsuranceService; protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); - onLoad(): void; getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; diff --git a/Live/CWX_WeatherPatcher/server/types/callbacks/LocationCallbacks.d.ts b/Live/CWX_WeatherPatcher/server/types/callbacks/LocationCallbacks.d.ts index cc69369..6e0b538 100644 --- a/Live/CWX_WeatherPatcher/server/types/callbacks/LocationCallbacks.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/callbacks/LocationCallbacks.d.ts @@ -11,4 +11,5 @@ export declare class LocationCallbacks { constructor(httpResponse: HttpResponseUtil, locationController: LocationController); getLocationData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocation(url: string, info: IGetLocationRequestData, sessionID: string): IGetBodyResponseData; + getAirdropLoot(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/Live/CWX_WeatherPatcher/server/types/callbacks/ProfileCallbacks.d.ts b/Live/CWX_WeatherPatcher/server/types/callbacks/ProfileCallbacks.d.ts index 6a86fc0..183bb0a 100644 --- a/Live/CWX_WeatherPatcher/server/types/callbacks/ProfileCallbacks.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/callbacks/ProfileCallbacks.d.ts @@ -1,5 +1,6 @@ import { ProfileController } from "../controllers/ProfileController"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IGetMiniProfileRequestData } from "../models/eft/launcher/IGetMiniProfileRequestData"; @@ -12,20 +13,51 @@ import { ISearchFriendResponse } from "../models/eft/profile/ISearchFriendRespon import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** Handle profile related client events */ export declare class ProfileCallbacks { protected httpResponse: HttpResponseUtil; protected timeUtil: TimeUtil; protected profileController: ProfileController; constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); createProfile(url: string, info: IProfileCreateRequestData, sessionID: string): IGetBodyResponseData; - getProfileData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - regenerateScav(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Get the complete player profile (scav + pmc character) + * @param url + * @param info Empty + * @param sessionID Session id + * @returns Profile object + */ + getProfileData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle the creation of a scav profile for player + * Occurs post-raid and when profile first created immediately after character details are confirmed by player + * @param url + * @param info empty + * @param sessionID Session id + * @returns Profile object + */ + regenerateScav(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/profile/voice/change event + * @param url + * @param info Change voice request object + * @param sessionID Session id + * @returns Client response + */ changeVoice(url: string, info: IProfileChangeVoiceRequestData, sessionID: string): INullResponseData; + /** + * Handle client/game/profile/nickname/change event + * Client allows player to adjust their profile name + * @param url + * @param info Change nickname request object + * @param sessionID Session id + * @returns client response + */ changeNickname(url: string, info: IProfileChangeNicknameRequestData, sessionID: string): IGetBodyResponseData; validateNickname(url: string, info: IValidateNicknameRequestData, sessionID: string): IGetBodyResponseData; getReservedNickname(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** - * Called when creating a character, when you choose a character face/voice + * Called when creating a character when choosing a character face/voice * @param url * @param info response (empty) * @param sessionID diff --git a/Live/CWX_WeatherPatcher/server/types/callbacks/RagfairCallbacks.d.ts b/Live/CWX_WeatherPatcher/server/types/callbacks/RagfairCallbacks.d.ts index 3a405c9..c609f2f 100644 --- a/Live/CWX_WeatherPatcher/server/types/callbacks/RagfairCallbacks.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/callbacks/RagfairCallbacks.d.ts @@ -19,6 +19,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; +/** + * Handle ragfair related callback events + */ export declare class RagfairCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; protected logger: ILogger; diff --git a/Live/CWX_WeatherPatcher/server/types/callbacks/RepairCallbacks.d.ts b/Live/CWX_WeatherPatcher/server/types/callbacks/RepairCallbacks.d.ts index 63733fa..14edeeb 100644 --- a/Live/CWX_WeatherPatcher/server/types/callbacks/RepairCallbacks.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/callbacks/RepairCallbacks.d.ts @@ -6,6 +6,20 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa export declare class RepairCallbacks { protected repairController: RepairController; constructor(repairController: RepairController); + /** + * use trader to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + /** + * Use repair kit to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ repair(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/Live/CWX_WeatherPatcher/server/types/callbacks/TraderCallbacks.d.ts b/Live/CWX_WeatherPatcher/server/types/callbacks/TraderCallbacks.d.ts index 128d9b2..e4fd099 100644 --- a/Live/CWX_WeatherPatcher/server/types/callbacks/TraderCallbacks.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/callbacks/TraderCallbacks.d.ts @@ -9,10 +9,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); onLoad(): void; + onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - onUpdate(): boolean; } diff --git a/Live/CWX_WeatherPatcher/server/types/context/ContextVariable.d.ts b/Live/CWX_WeatherPatcher/server/types/context/ContextVariable.d.ts index e438947..0fe0a63 100644 --- a/Live/CWX_WeatherPatcher/server/types/context/ContextVariable.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/context/ContextVariable.d.ts @@ -4,7 +4,7 @@ export declare class ContextVariable { private timestamp; private type; constructor(value: any, type: ContextVariableType); - getValue(): any; + getValue(): T; getTimestamp(): Date; getType(): ContextVariableType; } diff --git a/Live/CWX_WeatherPatcher/server/types/controllers/BotController.d.ts b/Live/CWX_WeatherPatcher/server/types/controllers/BotController.d.ts index 5e6f05d..a5111d5 100644 --- a/Live/CWX_WeatherPatcher/server/types/controllers/BotController.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/controllers/BotController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotHelper } from "../helpers/BotHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; @@ -5,15 +6,22 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { IBotCore } from "../models/eft/common/tables/IBotCore"; import { Difficulty } from "../models/eft/common/tables/IBotType"; import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; +import { PmcAiService } from "../services/PmcAiService"; export declare class BotController { + protected logger: ILogger; protected databaseServer: DatabaseServer; protected botGenerator: BotGenerator; protected botHelper: BotHelper; + protected pmcAiService: PmcAiService; + protected botGenerationCacheService: BotGenerationCacheService; protected configServer: ConfigServer; + protected applicationContext: ApplicationContext; protected botConfig: IBotConfig; - constructor(databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -29,7 +37,18 @@ export declare class BotController { * @returns Difficulty object */ getBotDifficulty(type: string, difficulty: string): Difficulty; - protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string): Difficulty; + protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Generate bot profiles and store in cache + * @param sessionId Session id + * @param info bot generation request info + * @returns IBotBase array + */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the max number of bots allowed on a map + * Looks up location player is entering when getting cap value + * @returns cap number + */ getBotCap(): number; } diff --git a/Live/CWX_WeatherPatcher/server/types/controllers/GameController.d.ts b/Live/CWX_WeatherPatcher/server/types/controllers/GameController.d.ts index 85ec418..2d00898 100644 --- a/Live/CWX_WeatherPatcher/server/types/controllers/GameController.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/controllers/GameController.d.ts @@ -7,11 +7,13 @@ import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; protected localeService: LocaleService; @@ -20,9 +22,14 @@ export declare class GameController { protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + /** + * Make non-trigger-spawned raiders spawn earlier + always + */ + protected adjustLabsRaiderSpawnRate(): void; protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; + getValidGameVersion(): any; } diff --git a/Live/CWX_WeatherPatcher/server/types/controllers/HideoutController.d.ts b/Live/CWX_WeatherPatcher/server/types/controllers/HideoutController.d.ts index 3eefe1a..dcd8894 100644 --- a/Live/CWX_WeatherPatcher/server/types/controllers/HideoutController.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/controllers/HideoutController.d.ts @@ -28,6 +28,7 @@ import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,9 +46,10 @@ export declare class HideoutController { protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/Live/CWX_WeatherPatcher/server/types/controllers/InraidController.d.ts b/Live/CWX_WeatherPatcher/server/types/controllers/InraidController.d.ts index b899e7d..102a2fb 100644 --- a/Live/CWX_WeatherPatcher/server/types/controllers/InraidController.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/controllers/InraidController.d.ts @@ -5,9 +5,11 @@ import { ItemHelper } from "../helpers/ItemHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; @@ -15,6 +17,7 @@ import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class InraidController { + protected logger: ILogger; protected saveServer: SaveServer; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; @@ -29,16 +32,40 @@ export declare class InraidController { protected inRaidHelper: InRaidHelper; protected configServer: ConfigServer; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Handle updating the profile post-pmc raid + * @param sessionID session id + * @param offraidData post-raid data of raid + */ + protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Reduce body part hp to % of max + * @param pmcData profile to edit + * @param multipler multipler to apply to max health + */ + protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; + /** + * Handle updating the profile post-pscav raid + * @param sessionID session id + * @param offraidData post-raid data of raid + */ + protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Is the player dead after a raid - dead is anything other than "survived" / "runner" + * @param statusOnExit exit value from offraidData object + * @returns true if dead + */ + protected isPlayerDead(statusOnExit: string): boolean; /** * Mark inventory items as FiR if player survived raid, otherwise remove FiR from them * @param offraidData Save Progress Request * @param pmcData player profile * @param isPlayerScav Was the player a pScav */ - private markOrRemoveFoundInRaidItems; - private handlePostRaidPlayerScavProcess; - private handlePostRaidPlayerScavKarmaChanges; + protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; } diff --git a/Live/CWX_WeatherPatcher/server/types/controllers/InventoryController.d.ts b/Live/CWX_WeatherPatcher/server/types/controllers/InventoryController.d.ts index f57f731..f564919 100644 --- a/Live/CWX_WeatherPatcher/server/types/controllers/InventoryController.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/controllers/InventoryController.d.ts @@ -92,7 +92,11 @@ export declare class InventoryController { */ toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; /** - * Handles Tagging of items (primary Containers). + * Add a tag to an inventory item + * @param pmcData profile with item to add tag to + * @param body tag request data + * @param sessionID session id + * @returns client response object */ tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/Live/CWX_WeatherPatcher/server/types/controllers/LocationController.d.ts b/Live/CWX_WeatherPatcher/server/types/controllers/LocationController.d.ts index 90b6d7a..9db3205 100644 --- a/Live/CWX_WeatherPatcher/server/types/controllers/LocationController.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/controllers/LocationController.d.ts @@ -1,18 +1,33 @@ import { LocationGenerator } from "../generators/LocationGenerator"; +import { LootGenerator } from "../generators/LootGenerator"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; +import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; +import { LootItem } from "../models/spt/services/LootItem"; import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class LocationController { protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; protected logger: ILogger; protected locationGenerator: LocationGenerator; + protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; - constructor(jsonUtil: JsonUtil, logger: ILogger, locationGenerator: LocationGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil); + protected configServer: ConfigServer; + protected airdropConfig: IAirdropConfig; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; generateAll(): ILocationsGenerateAllResponse; + /** + * Get loot for an airdop container + * Generates it randomly based on config/airdrop.json values + * @returns Array of LootItem + */ + getAirdropLoot(): LootItem[]; } diff --git a/Live/CWX_WeatherPatcher/server/types/controllers/MatchController.d.ts b/Live/CWX_WeatherPatcher/server/types/controllers/MatchController.d.ts index 71cb7d3..07f6a89 100644 --- a/Live/CWX_WeatherPatcher/server/types/controllers/MatchController.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/controllers/MatchController.d.ts @@ -9,23 +9,33 @@ import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestDa import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; +import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { PmcAiService } from "../services/PmcAiService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { + protected logger: ILogger; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected matchLocationService: MatchLocationService; protected traderHelper: TraderHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; + protected profileSnapshotService: ProfileSnapshotService; + protected pmcAiService: PmcAiService; + protected botGenerationCacheService: BotGenerationCacheService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + protected botConfig: IBotConfig; + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/Live/CWX_WeatherPatcher/server/types/controllers/QuestController.d.ts b/Live/CWX_WeatherPatcher/server/types/controllers/QuestController.d.ts index 2cbccfb..282f50e 100644 --- a/Live/CWX_WeatherPatcher/server/types/controllers/QuestController.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/controllers/QuestController.d.ts @@ -39,16 +39,31 @@ export declare class QuestController { * @returns array of IQuest */ getClientQuests(sessionID: string): IQuest[]; + /** + * Is the quest for the opposite side the player is on + * @param side player side (usec/bear) + * @param questId questId to check + */ + protected questIsForOtherSide(side: string, questId: string): boolean; + /** + * Handle the client accepting a quest and starting it + * Send starting rewards if any to player and + * Send start notification if any to player + * @param pmcData Profile to update + * @param acceptedQuest Quest accepted + * @param sessionID Session id + * @returns client response + */ acceptQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; acceptRepeatableQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; /** - * Remove completed quest from profile + * Update completed quest in profile * Add newly unlocked quests to profile * Also recalculate thier level due to exp rewards * @param pmcData Player profile - * @param body completed quest request - * @param sessionID session id - * @returns ItemEvent response + * @param body Completed quest request + * @param sessionID Session id + * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -67,10 +82,20 @@ export declare class QuestController { protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** * Fail the quests provided + * Update quest in profile, otherwise add fresh quest object with failed status * @param sessionID session id * @param pmcData player profile * @param questsToFail quests to fail */ protected failQuests(sessionID: string, pmcData: IPmcData, questsToFail: IQuest[]): void; handoverQuest(pmcData: IPmcData, body: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Increment a backend counter stored value by an amount, + * Create counter if it does not exist + * @param pmcData Profile to find backend counter in + * @param conditionId backend counter id to update + * @param questId quest id counter is associated with + * @param counterValue value to increment the backend counter with + */ + protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void; } diff --git a/Live/CWX_WeatherPatcher/server/types/controllers/RagfairController.d.ts b/Live/CWX_WeatherPatcher/server/types/controllers/RagfairController.d.ts index c4ffc15..06af740 100644 --- a/Live/CWX_WeatherPatcher/server/types/controllers/RagfairController.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/controllers/RagfairController.d.ts @@ -9,6 +9,7 @@ import { RagfairOfferHelper } from "../helpers/RagfairOfferHelper"; import { RagfairSellHelper } from "../helpers/RagfairSellHelper"; import { RagfairSortHelper } from "../helpers/RagfairSortHelper"; import { RagfairTaxHelper } from "../helpers/RagfairTaxHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; @@ -33,6 +34,9 @@ import { RagfairPriceService } from "../services/RagfairPriceService"; import { RagfairRequiredItemsService } from "../services/RagfairRequiredItemsService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** + * Handle RagfairCallback events + */ export declare class RagfairController { protected logger: ILogger; protected timeUtil: TimeUtil; @@ -52,14 +56,20 @@ export declare class RagfairController { protected handbookHelper: HandbookHelper; protected paymentHelper: PaymentHelper; protected inventoryHelper: InventoryHelper; + protected traderHelper: TraderHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected ragfairOfferGenerator: RagfairOfferGenerator; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + /** + * Update a trader flea offer with buy restrictions stored in the traders assort + * @param offer flea offer to update + */ + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer): void; protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; diff --git a/Live/CWX_WeatherPatcher/server/types/controllers/RepairController.d.ts b/Live/CWX_WeatherPatcher/server/types/controllers/RepairController.d.ts index 0e78ef6..ae54a53 100644 --- a/Live/CWX_WeatherPatcher/server/types/controllers/RepairController.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/controllers/RepairController.d.ts @@ -8,9 +8,9 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa import { IRepairConfig } from "../models/spt/config/IRepairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; -import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { PaymentService } from "../services/PaymentService"; +import { RepairService } from "../services/RepairService"; export declare class RepairController { protected logger: ILogger; protected itemEventRouter: ItemEventRouter; @@ -19,23 +19,23 @@ export declare class RepairController { protected traderHelper: TraderHelper; protected paymentService: PaymentService; protected repairHelper: RepairHelper; - protected configServer: ConfigServer; + protected repairService: RepairService; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); /** * Repair with trader - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + traderRepair(sessionID: string, body: ITraderRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; /** * Repair with repair kit - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - repairWithKit(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + repairWithKit(sessionID: string, body: IRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; } diff --git a/Live/CWX_WeatherPatcher/server/types/controllers/RepeatableQuestController.d.ts b/Live/CWX_WeatherPatcher/server/types/controllers/RepeatableQuestController.d.ts index 98d05dd..4c31a3d 100644 --- a/Live/CWX_WeatherPatcher/server/types/controllers/RepeatableQuestController.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/controllers/RepeatableQuestController.d.ts @@ -7,6 +7,7 @@ import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; import { TraderInfo } from "../models/eft/common/tables/IBotBase"; import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; import { ELocationName } from "../models/enums/ELocationName"; @@ -15,6 +16,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -64,9 +66,10 @@ export declare class RepeatableQuestController { protected itemEventRouter: ItemEventRouter; protected paymentService: PaymentService; protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. @@ -217,4 +220,16 @@ export declare class RepeatableQuestController { debugLogRepeatableQuestIds(pmcData: IPmcData): void; probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; changeRepeatableQuest(pmcDataIn: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {*} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; } diff --git a/Live/CWX_WeatherPatcher/server/types/controllers/TraderController.d.ts b/Live/CWX_WeatherPatcher/server/types/controllers/TraderController.d.ts index 7bab158..b79f55e 100644 --- a/Live/CWX_WeatherPatcher/server/types/controllers/TraderController.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/controllers/TraderController.d.ts @@ -4,6 +4,7 @@ import { TraderHelper } from "../helpers/TraderHelper"; import { IBarterScheme, ITraderAssort, ITraderBase } from "../models/eft/common/tables/ITrader"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -15,12 +16,29 @@ export declare class TraderController { protected traderHelper: TraderHelper; protected timeUtil: TimeUtil; protected traderAssortService: TraderAssortService; + protected fenceService: FenceService; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, fenceService: FenceService, jsonUtil: JsonUtil); + /** + * Runs when onLoad event is fired + * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Store timestamp of next assort refresh in nextResupply property of traders .base object + */ load(): void; - getTrader(traderID: string, sessionID: string): ITraderBase; + /** + * Runs when onUpdate is fired + * If current time is > nextResupply(expire) time of trader, refresh traders assorts and + * Fence is handled slightly differently + * @returns has run + */ + update(): boolean; + /** + * Return an array of all traders + * @param sessionID Session id + * @returns array if ITraderBase objects + */ getAllTraders(sessionID: string): ITraderBase[]; - updateTraders(): boolean; + getTrader(sessionID: string, traderID: string): ITraderBase; getAssort(sessionId: string, traderId: string): ITraderAssort; - getPurchasesData(traderID: string, sessionID: string): Record; + getPurchasesData(sessionID: string, traderID: string): Record; } diff --git a/Live/CWX_WeatherPatcher/server/types/di/Container.d.ts b/Live/CWX_WeatherPatcher/server/types/di/Container.d.ts index 17791b0..98d1fa1 100644 --- a/Live/CWX_WeatherPatcher/server/types/di/Container.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/di/Container.d.ts @@ -1,4 +1,7 @@ import { DependencyContainer } from "tsyringe"; +/** + * Handle the registration of classes to be used by the Dependency Injection code + */ export declare class Container { static registerTypes(depContainer: DependencyContainer): void; static registerListTypes(depContainer: DependencyContainer): void; diff --git a/Live/CWX_WeatherPatcher/server/types/generators/BotGenerator.d.ts b/Live/CWX_WeatherPatcher/server/types/generators/BotGenerator.d.ts index a5fc0ad..2ac51db 100644 --- a/Live/CWX_WeatherPatcher/server/types/generators/BotGenerator.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/generators/BotGenerator.d.ts @@ -9,6 +9,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { PmcAiService } from "../services/PmcAiService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -30,9 +31,10 @@ export declare class BotGenerator { protected botEquipmentFilterService: BotEquipmentFilterService; protected botHelper: BotHelper; protected gameEventHelper: GameEventHelper; + protected pmcAiService: PmcAiService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, pmcAiService: PmcAiService, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -40,14 +42,14 @@ export declare class BotGenerator { * @param botTemplate base bot template to use (e.g. assault/pmcbot) * @returns */ - generatePlayerScav(role: string, difficulty: string, botTemplate: IBotType): IBotBase; - generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Choose if a bot should become a PMC by checking if bot type is allowed to become a Pmc in botConfig.convertFromChances and doing a random int check - * @param botRole the bot role to check if should be a pmc - * @returns true if should be a pmc + * Generate an array of bot objects for populate a raid with + * @param sessionId session id + * @param info request object + * @returns bot array */ - protected shouldBotBePmc(botRole: string): boolean; + generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** * Get a randomised PMC side based on bot config value 'isUsec' * @returns pmc side as string @@ -58,12 +60,30 @@ export declare class BotGenerator { * @returns IBotBase object */ protected getCloneOfBotBase(): IBotBase; - protected generateBot(bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + /** + * Create a IBotBase object with equipment/loot/exp etc + * @param sessionId Session id + * @param bot bots base file + * @param role botRole bot will use + * @param node Bot template from db/bots/x.json + * @param isPmc Is bot to be a PMC + * @param isPlayerScav is bot to be a p scav bot + * @returns IBotBase object + */ + protected generateBot(sessionId: string, bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; /** * Log the number of PMCs generated to the debug console + * @param output Generated bot array, ready to send to client */ protected logPmcGeneratedCount(output: IBotBase[]): void; - protected generateRandomLevel(min: number, max: number): BotGenerator.IRandomisedBotLevelResult; + /** + * Return a randomised bot level and exp value + * @param role botRole being generated for + * @param min Min exp value + * @param max Max exp value + * @returns IRandomisedBotLevelResult object + */ + protected generateRandomLevel(role: string, min: number, max: number): BotGenerator.IRandomisedBotLevelResult; /** * Converts health object to the required format * @param healthObj health object from bot json @@ -72,19 +92,23 @@ export declare class BotGenerator { */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; protected generateSkills(skillsObj: Skills): Skills; - /** - * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) - * @param pmcSide eft side (usec/bear) - * @returns pmc side as defined in config - */ - protected getPmcRole(pmcSide: string): string; /** * Iterate through bots inventory and loot to find and remove christmas items (as defined in GameEventHelper) * @param nodeInventory Bots inventory to iterate over */ protected removeChristmasItemsFromBotInventory(nodeInventory: Inventory): void; + /** + * Generate a random Id for a bot and apply to bots _id and aid value + * @param bot bot to update + * @returns updated IBotBase object + */ protected generateId(bot: IBotBase): IBotBase; protected generateInventoryID(profile: IBotBase): IBotBase; + /** + * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * @param requestedDifficulty + * @returns + */ protected getPMCDifficulty(requestedDifficulty: string): string; /** * Add a side-specific (usec/bear) dogtag item to a bots inventory diff --git a/Live/CWX_WeatherPatcher/server/types/generators/BotInventoryGenerator.d.ts b/Live/CWX_WeatherPatcher/server/types/generators/BotInventoryGenerator.d.ts index 35d1ee8..c5ed545 100644 --- a/Live/CWX_WeatherPatcher/server/types/generators/BotInventoryGenerator.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/generators/BotInventoryGenerator.d.ts @@ -1,13 +1,16 @@ +import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Inventory, Chances, Generation, Mods } from "../models/eft/common/tables/IBotType"; +import { Chances, Generation, Inventory, Mods } from "../models/eft/common/tables/IBotType"; +import { EquipmentSlots } from "../models/enums/EquipmentSlots"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; -import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; -import { BotWeaponGenerator } from "./BotWeaponGenerator"; import { BotLootGenerator } from "./BotLootGenerator"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; +import { BotWeaponGenerator } from "./BotWeaponGenerator"; export declare class BotInventoryGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -17,8 +20,14 @@ export declare class BotInventoryGenerator { protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper); - generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { + slot: EquipmentSlots; + shouldSpawn: boolean; + }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; protected generateInventoryBase(): PmcInventory; } diff --git a/Live/CWX_WeatherPatcher/server/types/generators/BotLootGenerator.d.ts b/Live/CWX_WeatherPatcher/server/types/generators/BotLootGenerator.d.ts index c6a3f29..c1f5310 100644 --- a/Live/CWX_WeatherPatcher/server/types/generators/BotLootGenerator.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/generators/BotLootGenerator.d.ts @@ -1,4 +1,5 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; @@ -20,11 +21,12 @@ export declare class BotLootGenerator { protected handbookHelper: HandbookHelper; protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botLootCacheService: BotLootCacheService, configServer: ConfigServer); - generateLoot(templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer); + generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached @@ -47,7 +49,7 @@ export declare class BotLootGenerator { * @param botRole bots role, .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; /** * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from diff --git a/Live/CWX_WeatherPatcher/server/types/generators/BotWeaponGenerator.d.ts b/Live/CWX_WeatherPatcher/server/types/generators/BotWeaponGenerator.d.ts index 9215214..487901b 100644 --- a/Live/CWX_WeatherPatcher/server/types/generators/BotWeaponGenerator.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/generators/BotWeaponGenerator.d.ts @@ -1,4 +1,5 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { MinMax } from "../models/common/MinMax"; @@ -14,6 +15,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { IInventoryMagGen } from "./weapongen/IInventoryMagGen"; export declare class BotWeaponGenerator { protected jsonUtil: JsonUtil; protected logger: ILogger; @@ -24,11 +26,24 @@ export declare class BotWeaponGenerator { protected botGeneratorHelper: BotGeneratorHelper; protected randomUtil: RandomUtil; protected configServer: ConfigServer; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, inventoryMagGenComponents: IInventoryMagGen[]); /** - * Get a random weapon from a bots pool of weapons (weighted) + * Pick a random weapon based on weightings and generate a functional weapon + * @param equipmentSlot Primary/secondary/holster + * @param botTemplateInventory e.g. assault.json + * @param weaponParentId + * @param modChances + * @param botRole role of bot, e.g. assault/followerBully + * @param isPmc Is weapon generated for a pmc + * @returns GenerateWeaponResult object + */ + generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + /** + * Get a random weighted weapon from a bots pool of weapons * @param equipmentSlot Primary/secondary/holster * @param botTemplateInventory e.g. assault.json * @returns weapon tpl @@ -39,43 +54,24 @@ export declare class BotWeaponGenerator { * @param weaponTpl weapon tpl to generate (use pickWeightedWeaponTplFromPool()) * @param equipmentSlot slot to fit into, primary/secondary/holster * @param botTemplateInventory e.g. assault.json - * @param weaponParentId - * @param modChances - * @param botRole + * @param weaponParentId ParentId of the weapon being generated + * @param modChances Dictionary of item types and % chance weapon will have that mod + * @param botRole e.g. assault/exusec * @param isPmc * @returns GenerateWeaponResult object */ - generateWeaponByTpl(weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; /** - * Generate an entirely random weapon - * @param equipmentSlot Primary/secondary/holster - * @param botTemplateInventory e.g. assault.json - * @param weaponParentId - * @param modChances - * @param botRole - * @param isPmc - * @returns GenerateWeaponResult object - */ - generateRandomWeapon(equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; - /** - * Create array with weapon base as only element - * Add additional properties as required - * @param weaponTpl - * @param weaponParentId - * @param equipmentSlot - * @param weaponItemTemplate + * Create array with weapon base as only element and + * add additional properties based on weapon type + * @param weaponTpl Weapon tpl to create item with + * @param weaponParentId Weapons parent id + * @param equipmentSlot e.g. primary/secondary/holster + * @param weaponItemTemplate db template for weapon * @param botRole for durability values - * @returns + * @returns Base weapon item in array */ - constructWeaponBaseArray(weaponTpl: string, weaponParentId: string, equipmentSlot: string, weaponItemTemplate: ITemplateItem, botRole: string): Item[]; - /** - * Add compatible magazines to an inventory based on a generated weapon - * @param weaponDetails - * @param magCounts - * @param inventory - * @param botRole the bot type we're getting generating extra mags for - */ - addExtraMagazinesToInventory(weaponDetails: GenerateWeaponResult, magCounts: MinMax, inventory: PmcInventory, botRole: string): void; + protected constructWeaponBaseArray(weaponTpl: string, weaponParentId: string, equipmentSlot: string, weaponItemTemplate: ITemplateItem, botRole: string): Item[]; /** * Get the mods necessary to kit out a weapon to its preset level * @param weaponTpl weapon to find preset for @@ -84,33 +80,21 @@ export declare class BotWeaponGenerator { * @returns array of weapon mods */ protected getPresetWeaponMods(weaponTpl: string, equipmentSlot: string, weaponParentId: string, itemTemplate: ITemplateItem, botRole: string): Item[]; - /** Checks if all required slots are occupied on a weapon and all it's mods */ + /** + * Checks if all required slots are occupied on a weapon and all it's mods + * @param weaponItemArray Weapon + mods + * @returns true if valid + */ protected isWeaponValid(weaponItemArray: Item[]): boolean; /** * Generates extra magazines or bullets (if magazine is internal) and adds them to TacticalVest and Pockets. * Additionally, adds extra bullets to SecuredContainer - * @param weaponMods - * @param weaponTemplate - * @param magCounts - * @param ammoTpl - * @param inventory - * @param botRole the bot type we're getting generating extra mags for - * @returns + * @param generatedWeaponResult object with properties for generated weapon (weapon mods pool / weapon template / ammo tpl) + * @param magCounts Magazine count to add to inventory + * @param inventory Inventory to add magazines to + * @param botRole The bot type we're getting generating extra mags for */ - protected generateExtraMagazines(weaponMods: Item[], weaponTemplate: ITemplateItem, magCounts: MinMax, ammoTpl: string, inventory: PmcInventory, botRole: string): void; - /** - * Get a randomised number of bullets for a specific magazine - * @param magCounts min and max count of magazines - * @param magTemplate magazine to generate bullet count for - * @returns bullet count number - */ - protected getRandomisedBulletCount(magCounts: MinMax, magTemplate: ITemplateItem): number; - /** - * Get a randomised count of magazines - * @param magCounts min and max value returned value can be between - * @returns numberical value of magazine count - */ - protected getRandomisedMagazineCount(magCounts: MinMax): number; + addExtraMagazinesToInventory(generatedWeaponResult: GenerateWeaponResult, magCounts: MinMax, inventory: PmcInventory, botRole: string): void; /** * Add ammo to the secure container * @param stackCount How many stacks of ammo to add @@ -127,21 +111,13 @@ export declare class BotWeaponGenerator { * @returns magazine tpl string */ protected getMagazineTplFromWeaponTemplate(weaponMods: Item[], weaponTemplate: ITemplateItem, botRole: string): string; - /** - * Get a weapons default magazine template id - * @param weaponTemplate weapon to get default magazine for - * @returns tpl of magazine - */ - protected getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; - protected addBulletsToVestAndPockets(ammoTpl: string, bulletCount: number, inventory: PmcInventory): void; /** * Finds and return a compatible ammo tpl based on the bots ammo weightings (x.json/inventory/equipment/ammo) * @param ammo a list of ammo tpls the weapon can use * @param weaponTemplate the weapon we want to pick ammo for - * @param isPmc is the ammo being gathered for a pmc (runs pmc ammo filtering) * @returns an ammo tpl that works with the desired gun */ - protected getCompatibleAmmo(ammo: Record>, weaponTemplate: ITemplateItem, isPmc: boolean): string; + protected getWeightedCompatibleAmmo(ammo: Record>, weaponTemplate: ITemplateItem): string; /** * Get a weapons compatible cartridge caliber * @param weaponTemplate Weapon to look up caliber of diff --git a/Live/CWX_WeatherPatcher/server/types/generators/LocationGenerator.d.ts b/Live/CWX_WeatherPatcher/server/types/generators/LocationGenerator.d.ts index bd368b5..cc61dcf 100644 --- a/Live/CWX_WeatherPatcher/server/types/generators/LocationGenerator.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/generators/LocationGenerator.d.ts @@ -3,10 +3,9 @@ import { GameEventHelper } from "../helpers/GameEventHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; -import { ILooseLoot, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; +import { ILooseLoot, SpawnpointsForced, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; import { Item } from "../models/eft/common/tables/IItem"; import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticLootDetails } from "../models/eft/common/tables/ILootBase"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -36,11 +35,19 @@ export declare class LocationGenerator { generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; + /** + * Create array of loose + forced loot using probability system + * @param dynamicLootDist + * @param staticAmmoDist + * @param locationName Location to generate loot for + * @returns Array of spawn points with loot in them + */ generateDynamicLoot(dynamicLootDist: ILooseLoot, staticAmmoDist: Record, locationName: string): SpawnpointTemplate[]; + /** + * Add forced spawn point loot into loot parameter array + * @param loot array to add forced loot to + * @param forcedSpawnPoints forced loot to add + */ + protected addForcedLoot(loot: SpawnpointTemplate[], forcedSpawnPoints: SpawnpointsForced[]): void; protected createItem(tpl: string, staticAmmoDist: Record, parentId?: string): IContainerItem; - protected getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; - protected getRandomValidCaliber(magTemplate: ITemplateItem): string; - protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; - protected createRandomMagCartridges(magTemplate: ITemplateItem, parentId: string, staticAmmoDist: Record, caliber?: string): Item; - protected createCartidges(parentId: string, ammoTpl: string, stackCount: number): Item; } diff --git a/Live/CWX_WeatherPatcher/server/types/generators/LootGenerator.d.ts b/Live/CWX_WeatherPatcher/server/types/generators/LootGenerator.d.ts new file mode 100644 index 0000000..bbc1915 --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/types/generators/LootGenerator.d.ts @@ -0,0 +1,58 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Preset } from "../models/eft/common/IGlobals"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { LootItem } from "../models/spt/services/LootItem"; +import { LootRequest } from "../models/spt/services/LootRequest"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { HashUtil } from "../utils/HashUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class LootGenerator { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected databaseServer: DatabaseServer; + protected randomUtil: RandomUtil; + protected itemHelper: ItemHelper; + protected itemFilterService: ItemFilterService; + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, itemFilterService: ItemFilterService); + /** + * Generate a list of items based on options passed in + * @param options parameters to adjust what loot is generated + * @returns An array of loot items + */ + createRandomloot(options: LootRequest): LootItem[]; + /** + * Construct item limit record to hold max and current item count + * @param limits limits as defined in config + * @returns record, key: item tplId, value: current/max item count allowed + */ + protected initItemLimitCounter(limits: Record): Record; + /** + * Find a random item in items.json and add to result array + * @param items items to choose from + * @param itemTypeCounts item limit counts + * @param options item filters + * @param result array to add found item to + * @returns true if item was valid and added to pool + */ + protected findAndAddRandomItemToLoot(items: [string, ITemplateItem][], itemTypeCounts: Record, options: LootRequest, result: LootItem[]): boolean; + /** + * + * Find a random item in items.json and add to result array + * @param globalDefaultPresets presets to choose from + * @param itemTypeCounts item limit counts + * @param result array to add found preset to + * @returns true if preset was valid and added to pool + */ + protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, Preset][], itemTypeCounts: Record, result: LootItem[]): boolean; +} diff --git a/Live/CWX_WeatherPatcher/server/types/generators/PMCLootGenerator.d.ts b/Live/CWX_WeatherPatcher/server/types/generators/PMCLootGenerator.d.ts index 64e6f7f..b9f2a83 100644 --- a/Live/CWX_WeatherPatcher/server/types/generators/PMCLootGenerator.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/generators/PMCLootGenerator.d.ts @@ -1,15 +1,21 @@ import { ItemHelper } from "../helpers/ItemHelper"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ConfigServer } from "../servers/ConfigServer"; import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +/** + * Handle the generation of dynamic PMC loot in pockets and backpacks + * and the removal of blacklisted items + */ export declare class PMCLootGenerator { protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; + protected itemFilterService: ItemFilterService; protected pocketLootPool: string[]; protected backpackLootPool: string[]; protected botConfig: IBotConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService); generatePMCPocketLootPool(): string[]; generatePMCBackpackLootPool(): string[]; } diff --git a/Live/CWX_WeatherPatcher/server/types/generators/RagfairAssortGenerator.d.ts b/Live/CWX_WeatherPatcher/server/types/generators/RagfairAssortGenerator.d.ts index cbdd7f2..db4811d 100644 --- a/Live/CWX_WeatherPatcher/server/types/generators/RagfairAssortGenerator.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/generators/RagfairAssortGenerator.d.ts @@ -1,5 +1,8 @@ import { ItemHelper } from "../helpers/ItemHelper"; +import { Preset } from "../models/eft/common/IGlobals"; import { Item } from "../models/eft/common/tables/IItem"; +import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -8,18 +11,40 @@ export declare class RagfairAssortGenerator { protected hashUtil: HashUtil; protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; protected generatedAssortItems: Item[]; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer); + protected ragfairConfig: IRagfairConfig; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); /** * Get an array of unique items that can be sold on the flea * @returns array of unique items */ getAssortItems(): Item[]; + /** + * Check internal generatedAssortItems array has objects + * @returns true if array has objects + */ protected assortsAreGenerated(): boolean; /** * Generate an array of items the flea can sell * @returns array of unique items */ protected generateRagfairAssortItems(): Item[]; + /** + * Get presets from globals.json + * @returns Preset object array + */ + protected getPresets(): Preset[]; + /** + * Get default presets from globals.json + * @returns Preset object array + */ + protected getDefaultPresets(): Preset[]; + /** + * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true + * @param tplId tplid to add to item + * @param id id to add to item + * @returns hydrated Item object + */ protected createRagfairAssortItem(tplId: string, id?: string): Item; } diff --git a/Live/CWX_WeatherPatcher/server/types/generators/RagfairOfferGenerator.d.ts b/Live/CWX_WeatherPatcher/server/types/generators/RagfairOfferGenerator.d.ts index 3e7f4cc..317cd6b 100644 --- a/Live/CWX_WeatherPatcher/server/types/generators/RagfairOfferGenerator.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/generators/RagfairOfferGenerator.d.ts @@ -41,15 +41,37 @@ export declare class RagfairOfferGenerator { createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; protected getTraderId(userID: string): string; protected getRating(userID: string): number; + /** + * Is the offers user rating growing + * @param userID user to check rating of + * @returns true if its growing + */ protected getRatingGrowing(userID: string): boolean; + /** + * Get number of section until offer should expire + * @param userID Id of the offer owner + * @param time Time the offer is posted + * @returns number of seconds until offer expires + */ protected getOfferEndTime(userID: string, time: number): number; /** * Create multiple offers for items by using a unique list of items we've generated previously - * @param expiredOffers + * @param expiredOffers optional, expired offers to regenerate */ generateDynamicOffers(expiredOffers?: Item[]): void; - generateTraderOffers(traderID: string): void; + /** + * Generate trader offers on flea using the traders assort data + * @param traderID Trader to generate offers for + */ + generateFleaOffersForTrader(traderID: string): void; protected getItemCondition(userID: string, items: Item[], itemDetails: ITemplateItem): Item[]; + /** + * Add missing conditions to an item if needed + * Durabiltiy for repairable items + * HpResource for medical items + * @param item item to add conditions to + * @returns Item with conditions added + */ protected addMissingCondition(item: Item): Item; protected getOfferRequirements(items: Item[]): { count: number; @@ -57,6 +79,14 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a flea offer and store it in the Ragfair server offers array + * @param userID owner of the offer + * @param time time offer is put up + * @param items items in the offer + * @param barterScheme + * @param loyalLevel + * @param price price of offer + * @param sellInOnePiece + * @returns */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/Live/CWX_WeatherPatcher/server/types/generators/ScavCaseRewardGenerator.d.ts b/Live/CWX_WeatherPatcher/server/types/generators/ScavCaseRewardGenerator.d.ts index c7d6ab7..89cb5c8 100644 --- a/Live/CWX_WeatherPatcher/server/types/generators/ScavCaseRewardGenerator.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/generators/ScavCaseRewardGenerator.d.ts @@ -8,9 +8,13 @@ import { RewardCountAndPriceDetails, ScavCaseRewardCountsAndPrices } from "../mo import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { RagfairPriceService } from "../services/RagfairPriceService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +/** + * Handle the creation of randomised scav case rewards + */ export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; @@ -18,9 +22,10 @@ export declare class ScavCaseRewardGenerator { protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param body client request diff --git a/Live/CWX_WeatherPatcher/server/types/generators/WeatherGenerator.d.ts b/Live/CWX_WeatherPatcher/server/types/generators/WeatherGenerator.d.ts index 44cecbb..8ddbe49 100644 --- a/Live/CWX_WeatherPatcher/server/types/generators/WeatherGenerator.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/generators/WeatherGenerator.d.ts @@ -1,7 +1,7 @@ import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { ConfigServer } from "../servers/ConfigServer"; import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class WeatherGenerator { @@ -21,11 +21,16 @@ export declare class WeatherGenerator { protected getAcceleratedTime(computedDate: Date): string; /** * Get current time formatted to fit BSGs requirement - * @param computedDate + * @param computedDate date to format into bsg style * @returns */ protected getNormalTime(computedDate: Date): string; - generateWeather(data: IWeatherData): IWeatherData; + /** + * Return randomised Weather data + * @param weatherData weather input data + * @returns Randomised weather data + */ + generateWeather(weatherData: IWeatherData): IWeatherData; protected getWeightedFog(): string; protected getWeightedRain(): number; protected getRandomFloat(node: string): number; diff --git a/Live/CWX_WeatherPatcher/server/types/generators/weapongen/IInventoryMagGen.d.ts b/Live/CWX_WeatherPatcher/server/types/generators/weapongen/IInventoryMagGen.d.ts new file mode 100644 index 0000000..792f510 --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/types/generators/weapongen/IInventoryMagGen.d.ts @@ -0,0 +1,6 @@ +import { InventoryMagGen } from "./InventoryMagGen"; +export interface IInventoryMagGen { + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_WeatherPatcher/server/types/generators/weapongen/InventoryMagGen.d.ts b/Live/CWX_WeatherPatcher/server/types/generators/weapongen/InventoryMagGen.d.ts new file mode 100644 index 0000000..30bf79f --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/types/generators/weapongen/InventoryMagGen.d.ts @@ -0,0 +1,16 @@ +import { MinMax } from "../../models/common/MinMax"; +import { Inventory } from "../../models/eft/common/tables/IBotBase"; +import { ITemplateItem } from "../../models/eft/common/tables/ITemplateItem"; +export declare class InventoryMagGen { + private magCounts; + private magazineTemplate; + private weaponTemplate; + private ammoTemplate; + private pmcInventory; + constructor(magCounts: MinMax, magazineTemplate: ITemplateItem, weaponTemplate: ITemplateItem, ammoTemplate: ITemplateItem, pmcInventory: Inventory); + getMagCount(): MinMax; + getMagazineTemplate(): ITemplateItem; + getWeaponTemplate(): ITemplateItem; + getAmmoTemplate(): ITemplateItem; + getPmcInventory(): Inventory; +} diff --git a/Live/CWX_WeatherPatcher/server/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts b/Live/CWX_WeatherPatcher/server/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts new file mode 100644 index 0000000..b754d5f --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/types/generators/weapongen/implementations/BarrelInventoryMagGen.d.ts @@ -0,0 +1,12 @@ +import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; +import { RandomUtil } from "../../../utils/RandomUtil"; +import { IInventoryMagGen } from "../IInventoryMagGen"; +import { InventoryMagGen } from "../InventoryMagGen"; +export declare class BarrelInventoryMagGen implements IInventoryMagGen { + protected randomUtil: RandomUtil; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + constructor(randomUtil: RandomUtil, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_WeatherPatcher/server/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/Live/CWX_WeatherPatcher/server/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts new file mode 100644 index 0000000..4fcb1e2 --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -0,0 +1,14 @@ +import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; +import { ItemHelper } from "../../../helpers/ItemHelper"; +import { ILogger } from "../../../models/spt/utils/ILogger"; +import { IInventoryMagGen } from "../IInventoryMagGen"; +import { InventoryMagGen } from "../InventoryMagGen"; +export declare class ExternalInventoryMagGen implements IInventoryMagGen { + protected logger: ILogger; + protected itemHelper: ItemHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + constructor(logger: ILogger, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_WeatherPatcher/server/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts b/Live/CWX_WeatherPatcher/server/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts new file mode 100644 index 0000000..4548a04 --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/types/generators/weapongen/implementations/InternalMagazineInventoryMagGen.d.ts @@ -0,0 +1,10 @@ +import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; +import { IInventoryMagGen } from "../IInventoryMagGen"; +import { InventoryMagGen } from "../InventoryMagGen"; +export declare class InternalMagazineInventoryMagGen implements IInventoryMagGen { + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + constructor(botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + getPriority(): number; + canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; + process(inventoryMagGen: InventoryMagGen): void; +} diff --git a/Live/CWX_WeatherPatcher/server/types/helpers/AssortHelper.d.ts b/Live/CWX_WeatherPatcher/server/types/helpers/AssortHelper.d.ts index 15586b9..bfc157f 100644 --- a/Live/CWX_WeatherPatcher/server/types/helpers/AssortHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/helpers/AssortHelper.d.ts @@ -17,7 +17,7 @@ export declare class AssortHelper { * @param assort assort items from a trader * @returns assort items minus locked quest assorts */ - stripLockedQuestAssort(pmcProfile: IPmcData, traderId: string, assort: ITraderAssort): ITraderAssort; + stripLockedQuestAssort(pmcProfile: IPmcData, traderId: string, assort: ITraderAssort, flea?: boolean): ITraderAssort; /** * Remove assorts from a trader that have not been unlocked yet * @param pmcProfile player profile @@ -32,5 +32,5 @@ export declare class AssortHelper { * @param itemID item id to remove from asort * @returns Modified assort */ - removeItemFromAssort(assort: ITraderAssort, itemID: string): ITraderAssort; + removeItemFromAssort(assort: ITraderAssort, itemID: string, flea?: boolean): ITraderAssort; } diff --git a/Live/CWX_WeatherPatcher/server/types/helpers/BotGeneratorHelper.d.ts b/Live/CWX_WeatherPatcher/server/types/helpers/BotGeneratorHelper.d.ts index 3cd7256..5e3e501 100644 --- a/Live/CWX_WeatherPatcher/server/types/helpers/BotGeneratorHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/helpers/BotGeneratorHelper.d.ts @@ -1,19 +1,33 @@ import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper"; -import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem"; -import { Grid, ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { ItemFilterService } from "../services/ItemFilterService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotWeaponGeneratorHelper } from "./BotWeaponGeneratorHelper"; import { ContainerHelper } from "./ContainerHelper"; import { InventoryHelper } from "./InventoryHelper"; import { ItemHelper } from "./ItemHelper"; import { ProbabilityHelper } from "./ProbabilityHelper"; +import { ProfileHelper } from "./ProfileHelper"; +export declare class BotModLimits { + scope: ItemCount; + scopeMax: number; + scopeBaseTypes: string[]; + flashlightLaser: ItemCount; + flashlightLaserMax: number; + flashlgihtLaserBaseTypes: string[]; +} +export declare class ItemCount { + count: number; +} export declare class BotGeneratorHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -25,16 +39,121 @@ export declare class BotGeneratorHelper { protected itemHelper: ItemHelper; protected inventoryHelper: InventoryHelper; protected containerHelper: ContainerHelper; + protected botEquipmentFilterService: BotEquipmentFilterService; + protected itemFilterService: ItemFilterService; + protected profileHelper: ProfileHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, configServer: ConfigServer); - generateModsForItem(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, configServer: ConfigServer); /** - * Is this magazine cylinder related (revolvers and grenade launchers) - * @param magazineParentName the name of the magazines parent - * @returns true if it is cylinder related + * Check mods are compatible and add to array + * @param equipment Equipment item to add mods to + * @param modPool Mod list to choose frm + * @param parentId parentid of item to add mod to + * @param parentTemplate template objet of item to add mods to + * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @returns Item + compatible mods as an array */ - magazineIsCylinderRelated(magazineParentName: string): boolean; + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + /** + * @param sessionId session id + * @param weapon Weapon to add mods to + * @param modPool Pool of compatible mods to attach to weapon + * @param weaponParentId parentId of weapon + * @param parentWeaponTemplate Weapon which mods will be generated on + * @param modSpawnChances Mod spawn chances + * @param ammoTpl Ammo tpl to use when generating magazines/cartridges + * @param botRole Role of bot weapon is generated for + * @returns Weapon + mods array + */ + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; + /** + * + * @param modSlot + * @param isRandomisableSlot + * @param modsParent + * @param botEquipBlacklist + * @param itemModPool + * @param weapon array with only weapon tpl in it, ready for mods to be added + * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) + * @param parentTemplate + * @returns + */ + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + /** + * Find mod tpls of a provided type and add to modPool + * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) + * @param modTemplate db object for modItem we get compatible mods from + * @param modPool Pool of mods we are adding to + */ + protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; + /** + * Check if mod item is on limited list + has surpassed the limit set for it + * @param botRole role the bot has e.g. assault + * @param modTemplate mods template data + * @param modLimits limits set for weapon being generated for this bot + * @returns true if over item limit + */ + protected modHasReachedItemLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits): boolean; + /** + * Initalise mod limits to be used when generating a weapon + * @param botRole "assault", "bossTagilla" or "pmc" + * @returns BotModLimits object + */ + protected initModLimits(botRole: string): BotModLimits; + /** + * Generate a pool of mods for this bots mod type if bot has values inside `randomisedWeaponModSlots` array found in bot.json/equipment[botrole] + * @param allowedMods Mods to be added to mod pool + * @param botEquipBlacklist blacklist of items not allowed to be added to mod pool + * @param modSlot Slot to generate mods for + * @param itemModPool base mod pool to replace values of + */ + protected generateDynamicWeaponModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record): void; + /** + * Find all compatible mods for equipment item and add to modPool + * @param itemDetails item to find mods for + * @param modPool ModPool to add mods to + */ + generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods): void; + /** + * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist + * @param allowedMods base mods to filter + * @param botEquipBlacklist equipment blacklist + * @param modSlot slot mods belong to + * @returns Filtered array of mod tpls + */ + protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; + /** + * Check if the specific item type on the weapon has reached the set limit + * @param modTpl log mod tpl if over type limit + * @param currentCount current number of this item on gun + * @param maxLimit mod limit allowed + * @param botRole role of bot we're checking weapon of + * @returns true if limit reached + */ + protected weaponModLimitReached(modTpl: string, currentCount: { + count: number; + }, maxLimit: number, botRole: string): boolean; + /** + * Log errors if mod is not compatible with slot + * @param modToAdd template of mod to check + * @param itemSlot slot the item will be placed in + * @param modSlot slot the mod will fill + * @param parentTemplate tempalte of the mods parent item + * @returns true if valid + */ + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + /** + * Create a mod item with parameters as properties + * @param modId _id + * @param modTpl _tpl + * @param parentId parentId + * @param modSlot slotId + * @param modTemplate Used to add additional properites in the upd object + * @returns Item object + */ + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem): Item; /** * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance @@ -46,7 +165,7 @@ export declare class BotGeneratorHelper { protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; /** * Get a list of containers that hold ammo - * e.g. mod_magazine + * e.g. mod_magazine / patron_in_weapon_000 * @returns string array */ protected getAmmoContainers(): string[]; @@ -62,11 +181,11 @@ export declare class BotGeneratorHelper { * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" - * - * @param {object} items The items where the CylinderMagazine's camora are appended to - * @param {object} modPool modPool which should include available cartrigdes - * @param {string} parentId The CylinderMagazine's UID - * @param {object} parentTemplate The CylinderMagazine's template + * @param items The items where the CylinderMagazine's camora are appended to + * @param modPool modPool which should include available cartrigdes + * @param parentId The CylinderMagazine's UID + * @param parentTemplate The CylinderMagazine's template + * @returns */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** @@ -75,6 +194,13 @@ export declare class BotGeneratorHelper { * @returns string array of shells fro luitple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + /** + * Adds properties to an item + * e.g. Repairable / HasHinge / Foldable / MaxDurability + * @param itemTemplate + * @param botRole Used by weapons to randomise the durability values + * @returns Item Upd object with extra properties + */ generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { upd?: Upd; }; @@ -92,13 +218,15 @@ export declare class BotGeneratorHelper { * @returns Repairable object */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; - protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** - * Sort by spawn chance, highest to lowest, higher is more common - * @param unsortedModArray String array to sort - * @returns Sorted string array + * Get a random mod from an items compatible mods Filter array + * @param modTpl + * @param parentSlot + * @param modSlot + * @param items + * @returns item tpl */ - protected sortModArray(unsortedModArray: string[]): string[]; + protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** * Can an item be added to an item without issue * @param items @@ -107,18 +235,8 @@ export declare class BotGeneratorHelper { * @returns true if possible */ isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; - /** - * Adds an item with all its childern into specified equipmentSlots, wherever it fits. - * @param equipmentSlots - * @param parentId - * @param parentTpl - * @param itemWithChildren - * @param inventory - * @returns a `boolean` indicating item was added - */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: PmcInventory): boolean; - protected itemAllowedInContainer(slot: Grid, itemTpl: string): boolean; } +/** TODO - move into own class */ export declare class ExhaustableArray { private itemPool; private randomUtil; diff --git a/Live/CWX_WeatherPatcher/server/types/helpers/BotHelper.d.ts b/Live/CWX_WeatherPatcher/server/types/helpers/BotHelper.d.ts index 9b89481..18738e5 100644 --- a/Live/CWX_WeatherPatcher/server/types/helpers/BotHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/helpers/BotHelper.d.ts @@ -13,11 +13,34 @@ export declare class BotHelper { protected configServer: ConfigServer; protected botConfig: IBotConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, configServer: ConfigServer); + /** + * Get difficulty settings for desired bot type, if not found use assault bot types + * @param type bot type to retreive difficulty of + * @param difficulty difficulty to get settings for (easy/normal etc) + * @returns Difficulty object + */ getBotDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Get a template object for the specified botRole from bots.types db + * @param role botRole to get template for + * @returns IBotType object + */ getBotTemplate(role: string): IBotType; + /** + * Get difficulty settings for a PMC + * @param type "usec" / "bear" + * @param difficulty what difficulty to retrieve + * @returns Difficulty object + */ getPmcDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Choose a random difficulty from - easy/normal/hard/impossible + * @returns random difficulty + */ + chooseRandomDifficulty(): string; /** * Randomise the chance the PMC will attack their own side + * Look up value in bot.json/chanceSameSideIsHostilePercent * @param difficultySettings pmc difficulty settings */ randomisePmcHostility(difficultySettings: Difficulty): void; @@ -31,7 +54,7 @@ export declare class BotHelper { */ addBotToFriendlyList(difficultySettings: Difficulty, typeToAdd: string): void; /** - * Add a bot to the ENEMY_BOT_TYPES array + * Add a bot to the ENEMY_BOT_TYPES array, do not add itself if its on the enemy list * @param difficultySettings bot settings to alter * @param typesToAdd bot type to add to enemy list */ @@ -42,4 +65,10 @@ export declare class BotHelper { * @param typesToAdd bot type to add to revenge list */ addBotToRevengeList(difficultySettings: Difficulty, typesToAdd: string[]): void; + /** + * Choose if a bot should become a PMC by checking if bot type is allowed to become a Pmc in botConfig.convertFromChances and doing a random int check + * @param botRole the bot role to check if should be a pmc + * @returns true if should be a pmc + */ + shouldBotBePmc(botRole: string): boolean; } diff --git a/Live/CWX_WeatherPatcher/server/types/helpers/BotWeaponGeneratorHelper.d.ts b/Live/CWX_WeatherPatcher/server/types/helpers/BotWeaponGeneratorHelper.d.ts new file mode 100644 index 0000000..7e25f56 --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -0,0 +1,78 @@ +import { MinMax } from "../models/common/MinMax"; +import { Inventory } from "../models/eft/common/tables/IBotBase"; +import { Item } from "../models/eft/common/tables/IItem"; +import { Grid, ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { HashUtil } from "../utils/HashUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { ContainerHelper } from "./ContainerHelper"; +import { InventoryHelper } from "./InventoryHelper"; +import { ItemHelper } from "./ItemHelper"; +export declare class BotWeaponGeneratorHelper { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected randomUtil: RandomUtil; + protected hashUtil: HashUtil; + protected inventoryHelper: InventoryHelper; + protected containerHelper: ContainerHelper; + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper); + /** + * Get a randomised number of bullets for a specific magazine + * @param magCounts min and max count of magazines + * @param magTemplate magazine to generate bullet count for + * @returns bullet count number + */ + getRandomisedBulletCount(magCounts: MinMax, magTemplate: ITemplateItem): number; + /** + * Get a randomised count of magazines + * @param magCounts min and max value returned value can be between + * @returns numberical value of magazine count + */ + getRandomisedMagazineCount(magCounts: MinMax): number; + /** + * Is this magazine cylinder related (revolvers and grenade launchers) + * @param magazineParentName the name of the magazines parent + * @returns true if it is cylinder related + */ + magazineIsCylinderRelated(magazineParentName: string): boolean; + /** + * Create a magazine using the parameters given + * @param magazineTpl Tpl of the magazine to create + * @param ammoTpl Ammo to add to magazine + * @param magTemplate template object of magazine + * @returns Item array + */ + createMagazine(magazineTpl: string, ammoTpl: string, magTemplate: ITemplateItem): Item[]; + /** + * Add a specific number of cartrdiges to a bots inventory (vest/pocket) + * @param ammoTpl Ammo tpl to add to vest/pockets + * @param cartridgeCount number of cartridges to add to vest/pockets + * @param inventory bot inventory to add cartridges to + */ + addBulletsToVestAndPockets(ammoTpl: string, cartridgeCount: number, inventory: Inventory): void; + /** + * Get a weapons default magazine template id + * @param weaponTemplate weapon to get default magazine for + * @returns tpl of magazine + */ + getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string; + /** + * Adds an item with all its childern into specified equipmentSlots, wherever it fits. + * @param equipmentSlots + * @param parentId + * @param parentTpl + * @param itemWithChildren + * @param inventory + * @returns a `boolean` indicating item was added + */ + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): boolean; + /** + * is the provided item allowed inside a container + * @param slot location item wants to be placed in + * @param itemTpl item being placed + * @returns true if allowed + */ + protected itemAllowedInContainer(slot: Grid, itemTpl: string): boolean; +} diff --git a/Live/CWX_WeatherPatcher/server/types/helpers/HideoutHelper.d.ts b/Live/CWX_WeatherPatcher/server/types/helpers/HideoutHelper.d.ts index 36e4009..7495a6a 100644 --- a/Live/CWX_WeatherPatcher/server/types/helpers/HideoutHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/helpers/HideoutHelper.d.ts @@ -44,14 +44,72 @@ export declare class HideoutHelper { initProduction(recipeId: string, productionTime: number): Production; isProductionType(productive: Productive): productive is Production; applyPlayerUpgradesBonuses(pmcData: IPmcData, bonus: StageBonus): void; + /** + * TODO: + * After looking at the skills there doesnt seem to be a configuration per skill to boost + * the XP gain PER skill. I THINK you should be able to put the variable "SkillProgress" (just like health has it) + * and be able to tune the skill gain PER skill, but I havent tested it and Im not sure! + * @param pmcData + * @param bonus + */ protected applySkillXPBoost(pmcData: IPmcData, bonus: StageBonus): void; + /** + * Process a players hideout, update areas that use resources + increment production timers + * @param sessionID Session id + */ updatePlayerHideout(sessionID: string): void; + /** + * Update progress timer for water collector + * @param pmcData profile to update + * @param productionId id of water collection production to update + * @param hideoutProperties Hideout properties + */ + protected updateWaterCollectorProductionTimer(pmcData: IPmcData, productionId: string, hideoutProperties: { + btcFarmCGs?: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Iterate over productions and update their progress timers + * @param pmcData Profile to check for productions and update + * @param hideoutProperties Hideout properties + */ + protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; + /** + * Update progress timer for scav case + * @param pmcData Profile to update + * @param productionId Id of scav case production to update + */ + protected updateScavCaseProductionTimer(pmcData: IPmcData, productionId: string): void; + /** + * Iterate over hideout areas that use resources (fuel/filters etc) and update associated values + * @param sessionID Session id + * @param pmcData Profile to update areas of + * @param hideoutProperties hideout properties + */ + protected updateAreasWithResources(sessionID: string, pmcData: IPmcData, hideoutProperties: { + btcFarmCGs: number; + isGeneratorOn: boolean; + waterCollectorHasFilter: boolean; + }): void; protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; - protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): HideoutArea; - protected updateWaterFilters(waterFilterArea: HideoutArea, pwProd: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; + /** + * Adjust water filter objects resourceValue or delete when they reach 0 resource + * @param waterFilterArea water filter area to update + * @param production production object + * @param isGeneratorOn is generatory enabled + * @param pmcData Player profile + * @returns Updated HideoutArea object + */ + protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; - protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): HideoutArea; + protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void; protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production; protected getBTCSlots(pmcData: IPmcData): number; protected getManagementSkillsSlots(): number; diff --git a/Live/CWX_WeatherPatcher/server/types/helpers/InRaidHelper.d.ts b/Live/CWX_WeatherPatcher/server/types/helpers/InRaidHelper.d.ts index c3cbfbb..962df38 100644 --- a/Live/CWX_WeatherPatcher/server/types/helpers/InRaidHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -15,19 +16,8 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); - /** - * Reset the SPT inraid property stored in a profile to 'none' - * @param sessionID Session id - */ - protected removePlayer(sessionID: string): void; - /** - * Some maps have one-time-use keys (e.g. Labs - * Remove the relevant key from an inventory based on the post-raid request data passed in - * @param offraidData post-raid data - * @param sessionID Session id - */ - protected removeMapAccessKey(offraidData: ISaveProgressRequestData, sessionID: string): void; + protected profileFixerService: ProfileFixerService; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); /** * Check an array of items and add an upd object to money items with a stack count of 1 * Single stack money items have no upd object and thus no StackObjectsCount, causing issues @@ -52,6 +42,18 @@ export declare class InRaidHelper { * @returns Reset profile object */ updateProfileBaseStats(profileData: IPmcData, saveProgressRequest: ISaveProgressRequestData, sessionID: string): IPmcData; + /** + * Some maps have one-time-use keys (e.g. Labs + * Remove the relevant key from an inventory based on the post-raid request data passed in + * @param offraidData post-raid data + * @param sessionID Session id + */ + protected removeMapAccessKey(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Set the SPT inraid location Profile property to 'none' + * @param sessionID Session id + */ + protected setPlayerInRaidLocationStatusToNone(sessionID: string): void; /** * Adds SpawnedInSession property to items found in a raid * Removes SpawnedInSession for non-scav players if item was taken into raid with SpawnedInSession = true @@ -93,5 +95,10 @@ export declare class InRaidHelper { * @returns true if item is kept after death */ isItemKeptAfterDeath(slotId: string): boolean; + /** + * Return the equipped items from a players inventory + * @param items Players inventory to search through + * @returns an array of equipped items + */ getPlayerGear(items: Item[]): Item[]; } diff --git a/Live/CWX_WeatherPatcher/server/types/helpers/InventoryHelper.d.ts b/Live/CWX_WeatherPatcher/server/types/helpers/InventoryHelper.d.ts index dc7cbca..b8e5c9d 100644 --- a/Live/CWX_WeatherPatcher/server/types/helpers/InventoryHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/helpers/InventoryHelper.d.ts @@ -43,6 +43,7 @@ export declare class InventoryHelper { constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; diff --git a/Live/CWX_WeatherPatcher/server/types/helpers/ItemHelper.d.ts b/Live/CWX_WeatherPatcher/server/types/helpers/ItemHelper.d.ts index 1701c62..0effaf2 100644 --- a/Live/CWX_WeatherPatcher/server/types/helpers/ItemHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/helpers/ItemHelper.d.ts @@ -1,35 +1,30 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { InsuredItem } from "../models/eft/common/tables/IBotBase"; import { Item, Repairable } from "../models/eft/common/tables/IItem"; +import { IStaticAmmoDetails } from "../models/eft/common/tables/ILootBase"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ObjectId } from "../utils/ObjectId"; +import { RandomUtil } from "../utils/RandomUtil"; declare class ItemHelper { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected randomUtil: RandomUtil; + protected objectId: ObjectId; + protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer); /** - * Checks if a id is a valid item. Valid meaning that it's an item that be stored in stash + * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl * @returns boolean; true for items that may be in player posession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {*} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - isValidRewardItem(tpl: string): boolean; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - getRewardableItems(): [string, ITemplateItem][]; /** * Check if the tpl / template Id provided is a descendent of the baseclass * @@ -84,6 +79,11 @@ declare class ItemHelper { * @returns {array} The array of StackSlotItems */ generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; + /** + * Get cloned copy of all item data from items.json + * @returns array of ITemplateItem objects + */ + getItems(): ITemplateItem[]; /** * Gets item data from items.json * @param tpl items template id to look up @@ -196,6 +196,22 @@ declare class ItemHelper { * @returns ItemSize object (width and height) */ getItemSize(items: Item[], rootItemId: string): ItemHelper.ItemSize; + /** + * Get a random cartridge from an items Filter property + * @param item + * @returns + */ + getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string; + createRandomMagCartridges(magTemplate: ITemplateItem, parentId: string, staticAmmoDist: Record, caliber?: string): Item; + protected getRandomValidCaliber(magTemplate: ITemplateItem): string; + protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; + createCartidges(parentId: string, ammoTpl: string, stackCount: number): Item; + /** + * Get the size of a stack, return 1 if no stack object count property found + * @param item Item to get stack size of + * @returns size of stack + */ + getItemStackSize(item: Item): number; } declare namespace ItemHelper { interface ItemSize { diff --git a/Live/CWX_WeatherPatcher/server/types/helpers/ProfileHelper.d.ts b/Live/CWX_WeatherPatcher/server/types/helpers/ProfileHelper.d.ts index 6c150c8..9c6560a 100644 --- a/Live/CWX_WeatherPatcher/server/types/helpers/ProfileHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/helpers/ProfileHelper.d.ts @@ -2,24 +2,41 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Stats } from "../models/eft/common/tables/IBotBase"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; +import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { ItemHelper } from "./ItemHelper"; export declare class ProfileHelper { + protected logger: ILogger; protected jsonUtil: JsonUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected profileSnapshotService: ProfileSnapshotService; protected fenceService: FenceService; - constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; getCompleteProfile(sessionID: string): IPmcData[]; + /** + * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen + * Server saves the post-raid changes prior to the xp screen getting the profile, this results in the xp screen using + * the now updated profile values as a base, meaning it shows x2 xp gained + * Instead, clone the post-raid profile (so we dont alter its values), apply the pre-raid xp values to the cloned objects and return + * Delete snapshot of pre-raid profile prior to returning profile data + * @param sessionId Session id + * @param output pmc and scav profiles array + * @param pmcProfile post-raid pmc profile + * @param scavProfile post-raid scav profile + * @returns updated profile array + */ + protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; /** * Add experience to a PMC inside the players profile diff --git a/Live/CWX_WeatherPatcher/server/types/helpers/QuestHelper.d.ts b/Live/CWX_WeatherPatcher/server/types/helpers/QuestHelper.d.ts index 0f68cd5..d66d150 100644 --- a/Live/CWX_WeatherPatcher/server/types/helpers/QuestHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/helpers/QuestHelper.d.ts @@ -36,13 +36,30 @@ export declare class QuestHelper { protected configServer: ConfigServer; protected questConfig: IQuestConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); - questStatus(pmcData: IPmcData, questID: string): QuestStatus; /** - * returns true is the condition is satisfied + * Get status of a quest by quest id + * @param pmcData Profile to search + * @param questID Quest id to look up + * @returns QuestStauts enum + */ + getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus; + /** + * returns true is the level condition is satisfied + * @param playerLevel Players level + * @param condition Quest condition + * @returns true if player level is greater than or equal to quest */ - evaluateLevel(pmcProfile: IPmcData, cond: AvailableForConditions): boolean; + doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; - rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progress: number): void; + /** + * Increase skill points of a skill on player profile + * @param sessionID Session id + * @param pmcData Player profile + * @param output output object to send back to client + * @param skillName Name of skill to increase skill points of + * @param progressAmount Amount of skill points to add to skill + */ + rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; getQuestLocale(questId: string): any; /** * Debug Routine for showing some information on the diff --git a/Live/CWX_WeatherPatcher/server/types/helpers/RagfairOfferHelper.d.ts b/Live/CWX_WeatherPatcher/server/types/helpers/RagfairOfferHelper.d.ts index 8d03bee..e9d72ca 100644 --- a/Live/CWX_WeatherPatcher/server/types/helpers/RagfairOfferHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/helpers/RagfairOfferHelper.d.ts @@ -22,12 +22,14 @@ import { ProfileHelper } from "./ProfileHelper"; import { RagfairHelper } from "./RagfairHelper"; import { RagfairServerHelper } from "./RagfairServerHelper"; import { RagfairSortHelper } from "./RagfairSortHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class RagfairOfferHelper { protected logger: ILogger; protected timeUtil: TimeUtil; protected hashUtil: HashUtil; protected itemEventRouter: ItemEventRouter; protected databaseServer: DatabaseServer; + protected traderHelper: TraderHelper; protected saveServer: SaveServer; protected dialogueHelper: DialogueHelper; protected itemHelper: ItemHelper; @@ -43,10 +45,10 @@ export declare class RagfairOfferHelper { protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; - processOffers(sessionID: string): boolean; + processOffersOnProfile(sessionID: string): boolean; protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; diff --git a/Live/CWX_WeatherPatcher/server/types/helpers/RagfairSellHelper.d.ts b/Live/CWX_WeatherPatcher/server/types/helpers/RagfairSellHelper.d.ts index 6ec004a..91b8a20 100644 --- a/Live/CWX_WeatherPatcher/server/types/helpers/RagfairSellHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/helpers/RagfairSellHelper.d.ts @@ -11,6 +11,12 @@ export declare class RagfairSellHelper { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateSellChance(baseChance: number, offerPrice: number, requirementsPriceInRub: number): number; - rollForSale(sellChance: number, count: number): SellResult[]; + calculateSellChance(baseChancePercent: number, offerPriceRub: number, playerListedPriceRub: number): number; + /** + * Determine if the offer being listed will be sold + * @param sellChancePercent chance item will sell + * @param itemSellCount count of items to sell + * @returns Array of purchases of item(s) lsited + */ + rollForSale(sellChancePercent: number, itemSellCount: number): SellResult[]; } diff --git a/Live/CWX_WeatherPatcher/server/types/helpers/RagfairServerHelper.d.ts b/Live/CWX_WeatherPatcher/server/types/helpers/RagfairServerHelper.d.ts index e4939d1..a03cdda 100644 --- a/Live/CWX_WeatherPatcher/server/types/helpers/RagfairServerHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/helpers/RagfairServerHelper.d.ts @@ -6,6 +6,7 @@ import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -13,6 +14,9 @@ import { RandomUtil } from "../utils/RandomUtil"; import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { ProfileHelper } from "./ProfileHelper"; +/** + * Helper class for common ragfair server actions + */ export declare class RagfairServerHelper { protected randomUtil: RandomUtil; protected hashUtil: HashUtil; @@ -23,11 +27,12 @@ export declare class RagfairServerHelper { protected localeService: LocaleService; protected dialogueHelper: DialogueHelper; protected jsonUtil: JsonUtil; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; protected static goodsReturnedTemplate: string; - constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); + constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Is item valid / on blacklist / quest item * @param itemDetails diff --git a/Live/CWX_WeatherPatcher/server/types/helpers/RepairHelper.d.ts b/Live/CWX_WeatherPatcher/server/types/helpers/RepairHelper.d.ts index 9a3ab29..5b09320 100644 --- a/Live/CWX_WeatherPatcher/server/types/helpers/RepairHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/helpers/RepairHelper.d.ts @@ -14,8 +14,17 @@ export declare class RepairHelper { protected configServer: ConfigServer; protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); - updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit?: boolean, applyRandomDegradation?: boolean): Item; - protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number): number; - protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, armorMax: number): number; + /** + * + * @param itemToRepair item to update durability details + * @param itemToRepairDetails db details of item to repair + * @param isArmor Is item being repaired a piece of armor + * @param amountToRepair how many unit of durability to repair + * @param useRepairKit Is item being repaired with a repair kit + * @param applyMaxDurabilityDegradation should item have max durability reduced + */ + updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit: boolean, traderQualityMultipler: number, applyMaxDurabilityDegradation?: boolean): void; + protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number, traderQualityMultipler: number): number; + protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, weaponMax: number, traderQualityMultipler: number): number; isWeaponTemplate(tpl: string): boolean; } diff --git a/Live/CWX_WeatherPatcher/server/types/helpers/TradeHelper.d.ts b/Live/CWX_WeatherPatcher/server/types/helpers/TradeHelper.d.ts index 975062b..7ab9768 100644 --- a/Live/CWX_WeatherPatcher/server/types/helpers/TradeHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/helpers/TradeHelper.d.ts @@ -39,6 +39,12 @@ export declare class TradeHelper { * @returns */ sellItem(pmcData: IPmcData, body: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Increment the assorts buy count by number of items purchased + * Show error on screen if player attepts 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; protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/Live/CWX_WeatherPatcher/server/types/helpers/TraderAssortHelper.d.ts b/Live/CWX_WeatherPatcher/server/types/helpers/TraderAssortHelper.d.ts index 91ba6b9..025efd6 100644 --- a/Live/CWX_WeatherPatcher/server/types/helpers/TraderAssortHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/helpers/TraderAssortHelper.d.ts @@ -1,7 +1,7 @@ import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator"; import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; import { Item } from "../models/eft/common/tables/IItem"; -import { ITraderAssort } from "../models/eft/common/tables/ITrader"; +import { ITrader, ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -10,13 +10,16 @@ import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; +import { TimeUtil } from "../utils/TimeUtil"; import { AssortHelper } from "./AssortHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class TraderAssortHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; protected mathUtil: MathUtil; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected assortHelper: AssortHelper; @@ -24,18 +27,32 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts + * Filter out assorts not unlocked due to level OR quest completion * @param sessionId session id - * @param traderId trader id - * @returns a traders assorts + * @param traderId traders id + * @returns a traders' assorts */ - getAssort(sessionId: string, traderId: string): ITraderAssort; + getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; + /** + * Reset a traders assorts and move nextResupply value to future + * Flag trader as needing a flea offer reset to be picked up by flea update() function + * @param trader trader details to alter + */ + resetExpiredTrader(trader: ITrader): void; + /** + * Does the supplied trader need its assorts refreshed + * @param traderID Trader to check + * @returns true they need refreshing + */ + traderAssortsHaveExpired(traderID: string): boolean; /** * Iterate over all assorts barter_scheme values, find barters selling for money and multiply by multipler in config * @param traderAssort Assorts to multiple price of diff --git a/Live/CWX_WeatherPatcher/server/types/helpers/TraderHelper.d.ts b/Live/CWX_WeatherPatcher/server/types/helpers/TraderHelper.d.ts index b2e9d38..0dc93e8 100644 --- a/Live/CWX_WeatherPatcher/server/types/helpers/TraderHelper.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/helpers/TraderHelper.d.ts @@ -9,6 +9,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { PlayerService } from "../services/PlayerService"; +import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -23,9 +24,10 @@ export declare class TraderHelper { protected handbookHelper: HandbookHelper; protected playerService: PlayerService; protected fenceService: FenceService; + protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -63,7 +65,7 @@ export declare class TraderHelper { * @param item * @returns boolean */ - protected isWeaponAndBelowTraderBuyDurability(traderID: string, item: Item): boolean; + protected isWeaponBelowTraderBuyDurability(traderID: string, item: Item): boolean; /** * Get the price of an item and all of its attached children * Take into account bonuses/adjsutments e.g. discounts @@ -97,6 +99,17 @@ export declare class TraderHelper { * @param sessionID session id */ lvlUp(traderID: string, sessionID: string): void; + /** + * Get the next update timestamp for a trader + * @param traderID Trader to look up update value for + * @returns future timestamp + */ + getNextUpdateTimestamp(traderID: string): number; + /** + * Get the reset time between trader assort refreshes in seconds + * @param traderId Trader to look up + * @returns Time in seconds + */ getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader diff --git a/Live/CWX_WeatherPatcher/server/types/loaders/PreAkiModLoader.d.ts b/Live/CWX_WeatherPatcher/server/types/loaders/PreAkiModLoader.d.ts index 6ded3c6..4ab1689 100644 --- a/Live/CWX_WeatherPatcher/server/types/loaders/PreAkiModLoader.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/loaders/PreAkiModLoader.d.ts @@ -33,9 +33,20 @@ export declare class PreAkiModLoader implements IModLoader { protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; /** - * - * @param mods Get an array of broken/invalid mods by name - * @returns Mod names array + * Check for duplciate mods loaded, show error if duplicate mod found + * @param modPackageData dictionary of mod package.json data + */ + protected checkForDuplicateMods(modPackageData: Record): void; + /** + * Check for and return duplicate strings inside an array + * @param stringArray Array to check for duplicates + * @returns string array of duplicates, empty if none found + */ + protected getDuplicates(stringArray: string[]): string[]; + /** + * Get an array of mods with errors that prevent them from working with SPT + * @param mods mods to validate + * @returns Mod names as array */ protected getBrokenMods(mods: string[]): string[]; /** @@ -57,7 +68,12 @@ export declare class PreAkiModLoader implements IModLoader { protected addMod(mod: string): Promise; protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record): boolean; protected isModCompatible(mod: IPackageJsonData, loadedMods: Record): boolean; - protected validMod(mod: string): boolean; + /** + * Validate a mod passes a number of checks + * @param modName name of mod in /mods/ to validate + * @returns true if valid + */ + protected validMod(modName: string): boolean; protected getLoadOrderRecursive(mod: string, result: Record, visited: Record): void; protected getLoadOrder(mods: Record): Record; getContainer(): DependencyContainer; diff --git a/Live/CWX_WeatherPatcher/server/types/models/eft/common/IGlobals.d.ts b/Live/CWX_WeatherPatcher/server/types/models/eft/common/IGlobals.d.ts index 9d28dbc..81e2023 100644 --- a/Live/CWX_WeatherPatcher/server/types/models/eft/common/IGlobals.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/models/eft/common/IGlobals.d.ts @@ -1175,5 +1175,6 @@ export interface Preset { _name: string; _parent: string; _items: Item[]; + /** Default presets have this property */ _encyclopedia?: string; } diff --git a/Live/CWX_WeatherPatcher/server/types/models/eft/common/ILocationBase.d.ts b/Live/CWX_WeatherPatcher/server/types/models/eft/common/ILocationBase.d.ts index b1dd448..78ade9a 100644 --- a/Live/CWX_WeatherPatcher/server/types/models/eft/common/ILocationBase.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/models/eft/common/ILocationBase.d.ts @@ -137,7 +137,7 @@ export interface BotLocationModifier { VisibleDistance: number; } export interface MinMaxBot { - WildSpawnType: string; + WildSpawnType: WildSpawnType; max: number; min: number; } @@ -195,7 +195,7 @@ export interface Wave { BotPreset: string; BotSide: string; SpawnPoints: string; - WildSpawnType: string; + WildSpawnType: WildSpawnType; isPlayers: boolean; number: number; slots_max: number; @@ -203,3 +203,7 @@ export interface Wave { time_max: number; time_min: number; } +export declare enum WildSpawnType { + ASSAULT = "assault", + MARKSMAN = "marksman" +} diff --git a/Live/CWX_WeatherPatcher/server/types/models/eft/common/tables/IBotBase.d.ts b/Live/CWX_WeatherPatcher/server/types/models/eft/common/tables/IBotBase.d.ts index 0ee468e..25cb861 100644 --- a/Live/CWX_WeatherPatcher/server/types/models/eft/common/tables/IBotBase.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/models/eft/common/tables/IBotBase.d.ts @@ -28,6 +28,8 @@ export interface IBotBase { CarExtractCounts: CarExtractCounts; SurvivorClass: SurvivorClass; WishList: string[]; + /** SPT specific property used during bot generation in raid */ + sptIsPmc?: boolean; } export interface Info { EntryPoint: string; @@ -66,13 +68,13 @@ export interface IBan { dateTime: number; } export declare enum BanType { - Chat = 0, - RagFair = 1, - Voip = 2, - Trading = 3, - Online = 4, - Friends = 5, - ChangeNickname = 6 + CHAT = 0, + RAGFAIR = 1, + VOIP = 2, + TRADING = 3, + ONLINE = 4, + FRIENDS = 5, + CHANGE_NICKNAME = 6 } export interface Customization { Head: string; @@ -312,11 +314,11 @@ export interface Notes { export interface CarExtractCounts { } export declare enum SurvivorClass { - Unknown = 0, - Neutralizer = 1, - Marauder = 2, - Paramedic = 3, - Survivor = 4 + UNKNOWN = 0, + NEUTRALIZER = 1, + MARAUDER = 2, + PARAMEDIC = 3, + SURVIVOR = 4 } export interface Quest { qid: string; diff --git a/Live/CWX_WeatherPatcher/server/types/models/eft/common/tables/ITemplateItem.d.ts b/Live/CWX_WeatherPatcher/server/types/models/eft/common/tables/ITemplateItem.d.ts index 23a1a14..8569e61 100644 --- a/Live/CWX_WeatherPatcher/server/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/models/eft/common/tables/ITemplateItem.d.ts @@ -34,6 +34,7 @@ export interface Props { LootExperience?: number; ExamineExperience?: number; HideEntrails?: boolean; + InsuranceDisabled?: boolean; RepairCost?: number; RepairSpeed?: number; ExtraSizeLeft?: number; @@ -79,7 +80,7 @@ export interface Props { HasShoulderContact?: boolean; SightingRange?: number; DoubleActionAccuracyPenaltyMult?: number; - ModesCount: any; + ModesCount?: any; DurabilityBurnModificator?: number; HeatFactor?: number; CoolFactor?: number; @@ -155,7 +156,7 @@ export interface Props { RigLayoutName?: string; MaxDurability?: number; armorZone?: string[]; - armorClass: any; + armorClass?: any; mousePenalty?: number; weaponErgonomicPenalty?: number; BluntThroughput?: number; @@ -206,6 +207,7 @@ export interface Props { IsOneoff?: boolean; MustBoltBeOpennedForExternalReload?: boolean; MustBoltBeOpennedForInternalReload?: boolean; + NoFiremodeOnBoltcatch?: boolean; BoltAction?: boolean; HipAccuracyRestorationDelay?: number; HipAccuracyRestorationSpeed?: number; @@ -252,8 +254,8 @@ export interface Props { foodUseTime?: number; foodEffectType?: string; StimulatorBuffs?: string; - effects_health: any; - effects_damage: any; + effects_health?: any; + effects_damage?: any; MaximumNumberOfUsage?: number; knifeHitDelay?: number; knifeHitSlashRate?: number; diff --git a/Live/CWX_WeatherPatcher/server/types/models/eft/common/tables/ITrader.d.ts b/Live/CWX_WeatherPatcher/server/types/models/eft/common/tables/ITrader.d.ts index f0fe2b5..37b2d61 100644 --- a/Live/CWX_WeatherPatcher/server/types/models/eft/common/tables/ITrader.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/models/eft/common/tables/ITrader.d.ts @@ -7,7 +7,7 @@ export interface ITrader { suits?: ISuit[]; } export interface ITraderBase { - refreshAssort: boolean; + refreshTraderRagfairOffers: boolean; _id: string; avatar: string; balance_dol: number; @@ -58,7 +58,7 @@ export interface Repair { quality: string; } export interface ITraderAssort { - nextResupply?: number; + nextResupply: number; items: Item[]; barter_scheme: Record; loyal_level_items: Record; @@ -67,6 +67,7 @@ export interface IBarterScheme { count: number; _tpl: string; onlyFunctional?: boolean; + sptQuestLocked?: boolean; } export interface ISuit { _id: string; diff --git a/Live/CWX_WeatherPatcher/server/types/models/eft/health/Effect.d.ts b/Live/CWX_WeatherPatcher/server/types/models/eft/health/Effect.d.ts index 2f0adac..7eb3ffc 100644 --- a/Live/CWX_WeatherPatcher/server/types/models/eft/health/Effect.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/models/eft/health/Effect.d.ts @@ -1,5 +1,5 @@ export declare enum Effect { - Fracture = "Fracture", - LightBleeding = "LightBleeding", - HeavyBleeding = "HeavyBleeding" + FRACTURE = "Fracture", + LIGHT_BLEEDING = "LightBleeding", + HEAVY_BLEEDING = "HeavyBleeding" } diff --git a/Live/CWX_WeatherPatcher/server/types/models/eft/health/IOffraidHealRequestData.d.ts b/Live/CWX_WeatherPatcher/server/types/models/eft/health/IOffraidHealRequestData.d.ts index c242300..26b02bd 100644 --- a/Live/CWX_WeatherPatcher/server/types/models/eft/health/IOffraidHealRequestData.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/models/eft/health/IOffraidHealRequestData.d.ts @@ -7,12 +7,12 @@ export interface IOffraidHealRequestData extends IBaseInteractionRequestData { time: number; } export declare enum BodyPart { - Head = 0, - Chest = 1, - Stomach = 2, - LeftArm = 3, - RightArm = 4, - LeftLeg = 5, - RightLeg = 6, - Common = 7 + HEAD = "Head", + CHEST = "Chest", + STOMACH = "Stomach", + LEFT_ARM = "LeftArm", + RIGHT_ARM = "RightArm", + LEFT_LEG = "LeftLeg", + RIGHT_LEG = "RightLeg", + COMMON = "Common" } diff --git a/Live/CWX_WeatherPatcher/server/types/models/eft/notifier/INotifier.d.ts b/Live/CWX_WeatherPatcher/server/types/models/eft/notifier/INotifier.d.ts index 8c48260..b248636 100644 --- a/Live/CWX_WeatherPatcher/server/types/models/eft/notifier/INotifier.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/models/eft/notifier/INotifier.d.ts @@ -1,9 +1,9 @@ export interface INotifierChannel { - "server": string; - "channel_id": string; - "url": string; - "notifierServer": string; - "ws": string; + server: string; + channel_id: string; + url: string; + notifierServer: string; + ws: string; } import { Message } from "../profile/IAkiProfile"; export interface INotification { diff --git a/Live/CWX_WeatherPatcher/server/types/models/eft/ragfair/IRagfairOffer.d.ts b/Live/CWX_WeatherPatcher/server/types/models/eft/ragfair/IRagfairOffer.d.ts index 63f655e..141b605 100644 --- a/Live/CWX_WeatherPatcher/server/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -15,6 +15,8 @@ export interface IRagfairOffer { name?: string; shortName?: string; loyaltyLevel: number; + buyRestrictionMax?: number; + buyRestrictionCurrent?: number; locked: boolean; unlimitedCount: boolean; summaryCost: number; diff --git a/Live/CWX_WeatherPatcher/server/types/models/enums/AmmoTypes.d.ts b/Live/CWX_WeatherPatcher/server/types/models/enums/AmmoTypes.d.ts index b52ddcf..254b410 100644 --- a/Live/CWX_WeatherPatcher/server/types/models/enums/AmmoTypes.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/models/enums/AmmoTypes.d.ts @@ -23,7 +23,7 @@ export declare enum Ammo762x54 { BT_GZH = "5e023d34e8a400319a28ed44", BS_GZH = "5e023d48186a883be655e551" } -export declare enum Ammo338Lapua { +export declare enum Ammo86x70 { TAC_X = "5fc382b6d6fa9c00c571bbc3", UCW = "5fc382c1016cce60e8341b20", AP = "5fc382a9d724d907e2077dab", @@ -85,13 +85,13 @@ export declare enum Ammo9x21 { PE_GZH = "5a26ac06c4a282000c5a90a8", BT_GZH = "5a26ac0ec4a28200741e1e18" } -export declare enum Ammo357Mag { +export declare enum Ammo9x33R { FMJ = "62330b3ed4dc74626d570b95", HOLLOW_POINT = "62330bfadc5883093563729b", SOFT_POINT = "62330c40bdd19b369e1e53d1", JACKET_HP = "62330c18744e5e31df12f516" } -export declare enum Ammo45ACP { +export declare enum Ammo1143x23ACP { MATCH_FMJ = "5e81f423763d9f754677bf2e", HYDRA_SHOK = "5efb0fc6aeb21837e749c801", LASERMATCH_FMJ = "5efb0d4f4bc50b58e81710f3", @@ -126,7 +126,7 @@ export declare enum Ammo556x45 { MK_318_MOD_0_SOST = "60194943740c5d77f6705eea", SSA_AP = "601949593ae8f707c4608daa" } -export declare enum Ammo300Blackout { +export declare enum Ammo762x35 { M62_TRACER = "619636be6db0f2477964e710", BCP_FMJ = "5fbe3ffdf8b6a877a729ea82", AP = "5fd20ff893a8961fc660a954", diff --git a/Live/CWX_WeatherPatcher/server/types/models/enums/BaseClasses.d.ts b/Live/CWX_WeatherPatcher/server/types/models/enums/BaseClasses.d.ts index e733bca..36ebc71 100644 --- a/Live/CWX_WeatherPatcher/server/types/models/enums/BaseClasses.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/models/enums/BaseClasses.d.ts @@ -25,6 +25,7 @@ export declare enum BaseClasses { SIGHTS = "5448fe7a4bdc2d6f028b456b", MEDS = "543be5664bdc2dd4348b4569", MONEY = "543be5dd4bdc2deb348b4569", + NIGHTVISION = "5a2c3a9486f774688b05e574", KEY = "543be5e94bdc2df1348b4568", KEY_MECHANICAL = "5c99f98d86f7745c314214b3", KEYCARD = "5c164d2286f774194c5e69fa", @@ -66,8 +67,8 @@ export declare enum BaseClasses { LUBRICANT = "57864e4c24597754843f8723", BATTERY = "57864ee62459775490116fc1", ASSAULT_SCOPE = "55818add4bdc2d5b648b456f", - REFLEX_SIGHT = "55818ad54bdc2ddc698b4569", TACTICAL_COMBO = "55818b164bdc2ddc698b456c", + FLASHLIGHT = "55818b084bdc2d5b648b4571", MAGAZINE = "5448bc234bdc2d3c308b4569", LIGHT_LASER = "55818b0e4bdc2dde698b456e", FLASH_HIDER = "550aa4bf4bdc2dd6348b456b", diff --git a/Live/CWX_WeatherPatcher/server/types/models/enums/BotAmount.d.ts b/Live/CWX_WeatherPatcher/server/types/models/enums/BotAmount.d.ts index d0e1df1..9ef9cab 100644 --- a/Live/CWX_WeatherPatcher/server/types/models/enums/BotAmount.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/models/enums/BotAmount.d.ts @@ -1,7 +1,7 @@ export declare enum BotAmount { - AsOnline = "AsOnline", - Low = "Low", - Medium = "Medium", - High = "High", - Horde = "Horde" + AS_ONLINE = "AsOnline", + LOW = "Low", + MEDIUM = "Medium", + HIGH = "High", + HORDE = "Horde" } diff --git a/Live/CWX_WeatherPatcher/server/types/models/enums/BotDifficulty.d.ts b/Live/CWX_WeatherPatcher/server/types/models/enums/BotDifficulty.d.ts index c901bcf..80e45ad 100644 --- a/Live/CWX_WeatherPatcher/server/types/models/enums/BotDifficulty.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/models/enums/BotDifficulty.d.ts @@ -1,8 +1,8 @@ export declare enum BotDifficulty { - AsOnline = "AsOnline", - Easy = "Easy", - Medium = "Medium", - Hard = "Hard", - Impossible = "Impossible", - Random = "Random" + AS_ONLINE = "AsOnline", + EASY = "Easy", + MEDIUM = "Medium", + HARD = "Hard", + IMPOSSIBLE = "Impossible", + RANDOM = "Random" } diff --git a/Live/CWX_WeatherPatcher/server/types/models/enums/ConfigTypes.d.ts b/Live/CWX_WeatherPatcher/server/types/models/enums/ConfigTypes.d.ts index 61d6f99..468ece5 100644 --- a/Live/CWX_WeatherPatcher/server/types/models/enums/ConfigTypes.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/models/enums/ConfigTypes.d.ts @@ -8,6 +8,7 @@ export declare enum ConfigTypes { IN_RAID = "aki-inraid", INSURANCE = "aki-insurance", INVENTORY = "aki-inventory", + ITEM = "aki-item", LOCALE = "aki-locale", LOCATION = "aki-location", MATCH = "aki-match", diff --git a/Live/CWX_WeatherPatcher/server/types/models/enums/ELocationName.d.ts b/Live/CWX_WeatherPatcher/server/types/models/enums/ELocationName.d.ts index b56cc08..7ae7caa 100644 --- a/Live/CWX_WeatherPatcher/server/types/models/enums/ELocationName.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/models/enums/ELocationName.d.ts @@ -1,5 +1,6 @@ export declare enum ELocationName { FACTORY_DAY = "factory4_day", + FACTORY_NIGHT = "factory4_night", BIGMAP = "bigmap", WOODS = "Woods", SHORELINE = "Shoreline", diff --git a/Live/CWX_WeatherPatcher/server/types/models/enums/MemberCategory.d.ts b/Live/CWX_WeatherPatcher/server/types/models/enums/MemberCategory.d.ts index 3bd9a21..a81380e 100644 --- a/Live/CWX_WeatherPatcher/server/types/models/enums/MemberCategory.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/models/enums/MemberCategory.d.ts @@ -1,13 +1,13 @@ export declare enum MemberCategory { - Default = 0, - Developer = 1, - UniqueId = 2, - Trader = 4, - Group = 8, - System = 16, - ChatModerator = 32, - ChatModeratorWithPermanentBan = 64, - UnitTest = 128, - Sherpa = 256, - Emissary = 512 + DEFAULT = 0, + DEVELOPER = 1, + UNIQUE_ID = 2, + TRADER = 4, + GROUP = 8, + SYSTEM = 16, + CHAT_MODERATOR = 32, + CHAT_MODERATOR_WITH_PERMANENT_BAN = 64, + UNIT_TEST = 128, + SHERPA = 256, + EMISSARY = 512 } diff --git a/Live/CWX_WeatherPatcher/server/types/models/enums/QuestRewardType.d.ts b/Live/CWX_WeatherPatcher/server/types/models/enums/QuestRewardType.d.ts index 1d3db86..16f7e39 100644 --- a/Live/CWX_WeatherPatcher/server/types/models/enums/QuestRewardType.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/models/enums/QuestRewardType.d.ts @@ -1,8 +1,8 @@ export declare enum QuestRewardType { - Skill = "Skill", - Experience = "Experience", - TraderStanding = "TraderStanding", - TraderUnlock = "TraderUnlock", - Item = "Item", - AssortmentUnlock = "AssortmentUnlock" + SKILL = "Skill", + EXPERIENCE = "Experience", + TRADER_STANDING = "TraderStanding", + TRADER_UNLOCK = "TraderUnlock", + ITEM = "Item", + ASSORTMENT_UNLOCK = "AssortmentUnlock" } diff --git a/Live/CWX_WeatherPatcher/server/types/models/enums/RaidMode.d.ts b/Live/CWX_WeatherPatcher/server/types/models/enums/RaidMode.d.ts index c5a8cff..e20cf3f 100644 --- a/Live/CWX_WeatherPatcher/server/types/models/enums/RaidMode.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/models/enums/RaidMode.d.ts @@ -1,5 +1,5 @@ export declare enum RaidMode { - Online = "Online", - Local = "Local", - Coop = "Coop" + ONLINE = "Online", + LOCAL = "Local", + COOP = "Coop" } diff --git a/Live/CWX_WeatherPatcher/server/types/models/enums/WeaponTypes.d.ts b/Live/CWX_WeatherPatcher/server/types/models/enums/WeaponTypes.d.ts new file mode 100644 index 0000000..867b052 --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/types/models/enums/WeaponTypes.d.ts @@ -0,0 +1,151 @@ +export declare enum Weapons127x55 { + ASH_12 = "5cadfbf7ae92152ac412eeef" +} +export declare enum Weapons86x70 { + MK_18 = "5fc22d7c187fea44d52eda44", + AXMC = "627e14b21713922ded6f2c15" +} +export declare enum Weapons9x39 { + AS_VAL = "57c44b372459772d2b39b8ce", + VSS_VINTOREZ = "57838ad32459774a17445cd2" +} +export declare enum Weapons762x54R { + SVDS = "5c46fbd72e2216398b5a8c9c", + MP_18 = "61f7c9e189e6fb1a5e3ea78d", + MOSIN_INFANTRY = "5bfd297f0db834001a669119", + MOSIN_SNIPER = "5ae08f0a5acfc408fb1398a1", + SV_98 = "55801eed4bdc2d89578b4588" +} +export declare enum Weapons762x51 { + VPO_101 = "5c501a4d2e221602b412b540", + DT_MDR_762 = "5dcbd56fdbd3d91b3e5468d5", + SA_58 = "5b0bbe4e5acfc40dc528a72d", + SCARH_BLACK = "6183afd850224f204c1da514", + SCARH_FDE = "6165ac306ef05c2ce828ef74", + HK_G28 = "6176aca650224f204c1da3fb", + M1A = "5aafa857e5b5b00018480968", + RFB = "5f2a9575926fd9352339381f", + RSASS = "5a367e5dc4a282000e49738f", + SR_25 = "5df8ce05b11454561e39243b", + DVL_10 = "588892092459774ac91d4b11", + M700 = "5bfea6e90db834001b7347f3", + T5000M = "5df24cf80dee1b22f862e9bc" +} +export declare enum Weapons366TKM { + VPO_209 = "59e6687d86f77411d949b251", + VPO_215 = "5de652c31b7e3716273428be" +} +export declare enum Weapons762x39 { + OP_SKS = "587e02ff24597743df3deaeb", + SKS = "574d967124597745970e7c94", + AK_103 = "5ac66d2e5acfc43b321d4b53", + AK_104 = "5ac66d725acfc43b321d4b60", + AKM = "59d6088586f774275f37482f", + AKMN = "5a0ec13bfcdbcb00165aa685", + AKMS = "59ff346386f77477562ff5e2", + AKMSN = "5abcbc27d8ce8700182eceeb", + MK47_MUTANT = "606587252535c57a13424cfd", + RD_704 = "628a60ae6b1d481ff772e9c8", + VPO_136 = "59e6152586f77473dc057aa1" +} +export declare enum Weapons762x35 { + MCX = "5fbcc1d9016cce60e8341ab3" +} +export declare enum Weapons556x45 { + ADAR_2_15 = "5c07c60e0db834002330051f", + AK_101 = "5ac66cb05acfc40198510a10", + AK_102 = "5ac66d015acfc400180ae6e4", + DT_MDR_556 = "5c488a752e221602b412af63", + HK_416A5 = "5bb2475ed4351e00853264e3", + HK_G36 = "623063e994fc3f7b302a9696", + M4A1 = "5447a9cd4bdc2dbd208b4567", + SCARL_BLACK = "6184055050224f204c1da540", + SCARL_FDE = "618428466ef05c2ce828f218", + TX15_DML = "5d43021ca4b9362eab4b5e25" +} +export declare enum Weapons545x39 { + AK_105 = "5ac66d9b5acfc4001633997a", + AK_74 = "5bf3e03b0db834001d2c4a9c", + AK_74M = "5ac4cd105acfc40016339859", + AK_74N = "5644bd2b4bdc2d3b4c8b4572", + AKS_74 = "5bf3e0490db83400196199af", + AKS_74N = "5ab8e9fcd8ce870019439434", + AKS_74U = "57dc2fa62459775949412633", + AKS_74UB = "5839a40f24597726f856b511", + AKS_74UN = "583990e32459771419544dd2", + SAG_AK = "628b5638ad252a16da6dd245", + SAG_AK_SHORT = "628b9c37a733087d0d7fe84b", + RPK_16 = "5beed0f50db834001c062b12" +} +export declare enum Weapons57x28FN { + FN_57_BLACK = "5d3eb3b0a4b93615055e84d2", + FN_57_FDE = "5d67abc1a4b93614ec50137f", + FN_P90 = "5cc82d76e24e8d00134b4b83" +} +export declare enum Weapons46x30HK { + MP7A1 = "5ba26383d4351e00334c93d9", + MP7A2 = "5bd70322209c4d00d7167b8f" +} +export declare enum Weapons1143x23 { + M1911A1 = "5e81c3cbac2bb513793cdc75", + M45A1 = "5f36a0e5fbf956000b716b65", + USP45 = "6193a720f8ee7e52e42109ed", + UMP45 = "5fc3e272f8b6a877a729eac5", + VECTOR45 = "5fb64bc92b1b027b1f50bcf2" +} +export declare enum Weapons9x33R { + CR_50DS = "61a4c8884f95bc3b2c5dc96f" +} +export declare enum Weapons9x21 { + SR_1MP = "59f98b4986f7746f546d2cef" +} +export declare enum Weapons9x19 { + GLOCK_17 = "5a7ae0c351dfba0017554310", + GLOCK_18C = "5b1fa9b25acfc40018633c01", + M9A3 = "5cadc190ae921500103bb3b6", + MP_443 = "576a581d2459771e7b1bc4f1", + P226R = "56d59856d2720bd8418b456a", + PL_15 = "602a9740da11d6478d5a06dc", + CR_200DS = "624c2e8614da335f1e034d8c", + MP5 = "5926bb2186f7744b1c6c6e60", + MP5K = "5d2f0d8048f0356c925bc3b0", + MP9 = "5e00903ae9dc277128008b87", + MP9_N = "5de7bd7bfd6b4e6e2276dc25", + MPX = "58948c8e86f77409493f7266", + PP_19_01 = "59984ab886f7743e98271174", + SAIGA_9 = "59f9cabd86f7743a10721f46", + STM_9 = "60339954d62c9b14ed777c06", + VECTOR_9MM = "5fc3f2d5900b1d5091531e57" +} +export declare enum Weapons9x18 { + APB = "5abccb7dd8ce87001773e277", + APS = "5a17f98cfcdbcb0980087290", + PB_SILENCED = "56e0598dd2720bb5668b45a6", + PM = "5448bd6b4bdc2dfc2f8b4569", + PM_T = "579204f224597773d619e051", + PP9_KLIN = "57f4c844245977379d5c14d1", + PP91_KEDR = "57d14d2524597714373db789", + PP91_KEDRB = "57f3c6bd24597738e730fa2f" +} +export declare enum Weapons762x25 { + TT = "571a12c42459771f627b58a0", + TT_GOLD = "5b3b713c5acfc4330140bd8d", + PPSH_41 = "5ea03f7400685063ec28bfa8" +} +export declare enum Weapons12Gauge { + M3_SUPER90 = "6259b864ebedf17603599e88", + M590A1 = "5e870397991fd70db46995c8", + M870 = "5a7828548dc32e5a9c28b516", + MP_133 = "54491c4f4bdc2db1078b4568", + MP_153 = "56dee2bdd2720bc8328b4567", + MP_155 = "606dae0ab0e443224b421bb7", + MP_43_1C = "5580223e4bdc2d1c128b457f", + MTS_255_12 = "60db29ce99594040e04c4a27", + SAIGA_12GA = "576165642459773c7a400233" +} +export declare enum Weapons20Gauge { + TOZ_106 = "5a38e6bac4a2826c6e06d79b" +} +export declare enum Weapons23x75 { + KS_23M = "5e848cc2988a8701445df1e8" +} diff --git a/Live/CWX_WeatherPatcher/server/types/models/spt/bots/BotLootCache.d.ts b/Live/CWX_WeatherPatcher/server/types/models/spt/bots/BotLootCache.d.ts index e185315..aedf7b0 100644 --- a/Live/CWX_WeatherPatcher/server/types/models/spt/bots/BotLootCache.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/models/spt/bots/BotLootCache.d.ts @@ -11,13 +11,13 @@ export declare class BotLootCache { grenadeItems: ITemplateItem[]; } export declare enum LootCacheType { - Special = "Special", - Backpack = "Backpack", - Pocket = "Pocket", - Vest = "Vest", - Combined = "Combined", - HealingItems = "HealingItems", - DrugItems = "DrugItems", - StimItems = "StimItems", - GrenadeItems = "GrenadeItems" + SPECIAL = "Special", + BACKPACK = "Backpack", + POCKET = "Pocket", + VEST = "Vest", + COMBINED = "Combined", + HEALING_ITEMS = "HealingItems", + DRUG_ITEMS = "DrugItems", + STIM_ITEMS = "StimItems", + GRENADE_ITEMS = "GrenadeItems" } diff --git a/Live/CWX_WeatherPatcher/server/types/models/spt/config/IAirdropConfig.d.ts b/Live/CWX_WeatherPatcher/server/types/models/spt/config/IAirdropConfig.d.ts index f4aee89..3edcbdd 100644 --- a/Live/CWX_WeatherPatcher/server/types/models/spt/config/IAirdropConfig.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/models/spt/config/IAirdropConfig.d.ts @@ -1,14 +1,14 @@ +import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IAirdropConfig extends IBaseConfig { kind: "aki-airdrop"; airdropChancePercent: AirdropChancePercent; - airdropMinOpenHeight: number; - airdropMaxOpenHeight: number; planeMinFlyHeight: number; planeMaxFlyHeight: number; planeVolume: number; airdropMinStartTimeSeconds: number; airdropMaxStartTimeSeconds: number; + loot: AirdropLoot; } export interface AirdropChancePercent { bigmap: number; @@ -18,3 +18,13 @@ export interface AirdropChancePercent { interchange: number; reserve: number; } +export interface AirdropLoot { + presetCount: MinMax; + itemCount: MinMax; + itemBlacklist: string[]; + itemTypeWhitelist: string[]; + /** key: item base type: value: max count */ + itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; +} diff --git a/Live/CWX_WeatherPatcher/server/types/models/spt/config/IBotConfig.d.ts b/Live/CWX_WeatherPatcher/server/types/models/spt/config/IBotConfig.d.ts index e171087..af8ceba 100644 --- a/Live/CWX_WeatherPatcher/server/types/models/spt/config/IBotConfig.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/models/spt/config/IBotConfig.d.ts @@ -1,17 +1,31 @@ import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; +import { IBotDurability } from "./IBotDurability"; +import { IPmcConfig } from "./IPmcConfig"; export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; + /** How many variants of each bot should be generated on raid start */ presetBatch: PresetBatch; + /** What bot types should be classified as bosses */ bosses: string[]; - durability: Durability; + /** Control weapon/armor durability min/max values for each bot type */ + durability: IBotDurability; + /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ lootNValue: LootNvalue; + /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; - pmc: PmcConfig; + /** PMC bot specific config settings */ + pmc: IPmcConfig; + /** Control how many items are allowed to spawn on a bot + * key: bottype, value: */ itemSpawnLimits: Record>; - equipment: Record; + /** Blacklist/whitelist items on a bot */ + equipment: Record; + /** Show a bots botType value after their name */ showTypeInNickname: boolean; - maxBotCap: number; + /** Max number of bots that can be spawned in a raid at any one time */ + maxBotCap: Record; + /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; } export interface PresetBatch { @@ -44,79 +58,23 @@ export interface PresetBatch { test: number; exUsec: number; } -export interface Durability { - default: DefaultDurability; - pmc: PmcDurability; - boss: BotDurability; - follower: BotDurability; - assault: BotDurability; - cursedassault: BotDurability; - marksman: BotDurability; - pmcbot: BotDurability; - exusec: BotDurability; - sectantpriest: BotDurability; - sectantwarrior: BotDurability; -} -export interface DefaultDurability { - armor: DefaultArmor; - weapon: WeaponDurability; -} -export interface DefaultArmor { - maxDelta: number; - minDelta: number; -} -export interface WeaponDurability { - lowestMax: number; - highestMax: number; - maxDelta: number; - minDelta: number; -} -export interface PmcDurability { - armor: PmcDurabilityArmor; - weapon: WeaponDurability; -} -export interface PmcDurabilityArmor { - lowestMaxPercent: number; - highestMaxPercent: number; - maxDelta: number; - minDelta: number; -} -export interface BotDurability { - armor: ArmorDurability; - weapon: WeaponDurability; -} -export interface ArmorDurability { - maxDelta: number; - minDelta: number; -} export interface LootNvalue { scav: number; pmc: number; } -export interface PmcConfig { - dynamicLoot: PmcDynamicLoot; - difficulty: string; - looseWeaponInBackpackChancePercent: number; - looseWeaponInBackpackLootMinMax: MinMax; - isUsec: number; - chanceSameSideIsHostilePercent: number; - usecType: string; - bearType: string; - maxBackpackLootTotalRub: number; - maxPocketLootTotalRub: number; - maxVestLootTotalRub: number; - convertIntoPmcChance: Record; - enemyTypes: string[]; -} -export interface PmcDynamicLoot { - whitelist: string[]; - blacklist: string[]; - moneyStackLimits: Record; -} -export interface Equipment { +export interface EquipmentFilters { + weaponModLimits: ModLimits; + randomisedWeaponModSlots?: string[]; + randomisedArmorSlots?: string[]; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; } +export interface ModLimits { + /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ + scopeLimit?: number; + /** How many lasers or lights are allowed on a weapon - hard coded to work with TACTICAL_COMBO, and FLASHLIGHT */ + lightLaserLimit?: number; +} export interface EquipmentFilterDetails { levelRange: MinMax; equipment: Record; diff --git a/Live/CWX_WeatherPatcher/server/types/models/spt/config/IBotDurability.d.ts b/Live/CWX_WeatherPatcher/server/types/models/spt/config/IBotDurability.d.ts new file mode 100644 index 0000000..38a47cc --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/types/models/spt/config/IBotDurability.d.ts @@ -0,0 +1,47 @@ +export interface IBotDurability { + default: DefaultDurability; + pmc: PmcDurability; + boss: BotDurability; + follower: BotDurability; + assault: BotDurability; + cursedassault: BotDurability; + marksman: BotDurability; + pmcbot: BotDurability; + exusec: BotDurability; + gifter: BotDurability; + sectantpriest: BotDurability; + sectantwarrior: BotDurability; +} +/** Durability values to be used when a more specific bot type cant be found */ +export interface DefaultDurability { + armor: DefaultArmor; + weapon: WeaponDurability; +} +export interface DefaultArmor { + maxDelta: number; + minDelta: number; +} +export interface WeaponDurability { + lowestMax: number; + highestMax: number; + maxDelta: number; + minDelta: number; +} +export interface PmcDurability { + armor: PmcDurabilityArmor; + weapon: WeaponDurability; +} +export interface PmcDurabilityArmor { + lowestMaxPercent: number; + highestMaxPercent: number; + maxDelta: number; + minDelta: number; +} +export interface BotDurability { + armor: ArmorDurability; + weapon: WeaponDurability; +} +export interface ArmorDurability { + maxDelta: number; + minDelta: number; +} diff --git a/Live/CWX_WeatherPatcher/server/types/models/spt/config/IHideoutConfig.d.ts b/Live/CWX_WeatherPatcher/server/types/models/spt/config/IHideoutConfig.d.ts index 36d6246..f232052 100644 --- a/Live/CWX_WeatherPatcher/server/types/models/spt/config/IHideoutConfig.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/models/spt/config/IHideoutConfig.d.ts @@ -2,6 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; runIntervalSeconds: number; - fuelDrainRateMultipler: number; hoursForSkillCrafting: number; + generatorSpeedWithoutFuel: number; + generatorFuelFlowRate: number; + airFilterUnitFlowRate: number; + /** SEE HIDEOUTHELPER BEFORE CHANGING CONFIG */ + gpuBoostRate: number; } diff --git a/Live/CWX_WeatherPatcher/server/types/models/spt/config/IItemConfig.d.ts b/Live/CWX_WeatherPatcher/server/types/models/spt/config/IItemConfig.d.ts new file mode 100644 index 0000000..5ecccc2 --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/types/models/spt/config/IItemConfig.d.ts @@ -0,0 +1,5 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface IItemConfig extends IBaseConfig { + kind: "aki-item"; + blacklist: string[]; +} diff --git a/Live/CWX_WeatherPatcher/server/types/models/spt/config/IPmcConfig.d.ts b/Live/CWX_WeatherPatcher/server/types/models/spt/config/IPmcConfig.d.ts new file mode 100644 index 0000000..9db2ba1 --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/types/models/spt/config/IPmcConfig.d.ts @@ -0,0 +1,26 @@ +import { MinMax } from "../../common/MinMax"; +export interface IPmcConfig { + dynamicLoot: DynamicLoot; + useDifficultyOverride: boolean; + difficulty: string; + looseWeaponInBackpackChancePercent: number; + looseWeaponInBackpackLootMinMax: MinMax; + isUsec: number; + chanceSameSideIsHostilePercent: number; + /** key: location, value: type for usec/bear */ + pmcType: Record; + maxBackpackLootTotalRub: number; + maxPocketLootTotalRub: number; + maxVestLootTotalRub: number; + convertIntoPmcChance: Record; + enemyTypes: string[]; +} +export interface PmcTypes { + usec: string; + bear: string; +} +export interface DynamicLoot { + whitelist: string[]; + blacklist: string[]; + moneyStackLimits: Record; +} diff --git a/Live/CWX_WeatherPatcher/server/types/models/spt/config/IQuestConfig.d.ts b/Live/CWX_WeatherPatcher/server/types/models/spt/config/IQuestConfig.d.ts index be4a97b..45c9aae 100644 --- a/Live/CWX_WeatherPatcher/server/types/models/spt/config/IQuestConfig.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/models/spt/config/IQuestConfig.d.ts @@ -4,6 +4,8 @@ export interface IQuestConfig extends IBaseConfig { kind: "aki-quest"; redeemTime: number; repeatableQuests: IRepeatableQuestConfig[]; + bearOnlyQuests: string[]; + usecOnlyQuests: string[]; } export interface IRepeatableQuestConfig { name: string; @@ -15,6 +17,10 @@ export interface IRepeatableQuestConfig { locations: Record; traderWhitelist: ITraderWhitelist[]; questConfig: IQuestConfig; + /** Item base types to block when generating rewards */ + rewardBaseTypeBlacklist: string[]; + /** Item tplIds to ignore when generating rewards */ + rewardBlacklist: string[]; } export interface IRewardScaling { levels: number[]; diff --git a/Live/CWX_WeatherPatcher/server/types/models/spt/config/IRagfairConfig.d.ts b/Live/CWX_WeatherPatcher/server/types/models/spt/config/IRagfairConfig.d.ts index c24e617..c1b8763 100644 --- a/Live/CWX_WeatherPatcher/server/types/models/spt/config/IRagfairConfig.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/models/spt/config/IRagfairConfig.d.ts @@ -12,6 +12,7 @@ export interface Sell { chance: Chance; time: Time; reputation: Reputation; + simulatedSellHours: number; } export interface Chance { base: number; @@ -27,11 +28,18 @@ export interface Reputation { gain: number; loss: number; } +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Dynamic { + offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; price: MinMax; presetPrice: MinMax; + showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; condition: Condition; stackablePercent: MinMax; diff --git a/Live/CWX_WeatherPatcher/server/types/models/spt/config/ITraderConfig.d.ts b/Live/CWX_WeatherPatcher/server/types/models/spt/config/ITraderConfig.d.ts index c8e8044..6b1c1e3 100644 --- a/Live/CWX_WeatherPatcher/server/types/models/spt/config/ITraderConfig.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/models/spt/config/ITraderConfig.d.ts @@ -12,8 +12,10 @@ export interface UpdateTime { seconds: number; } export interface FenceConfig { + partialRefreshTimeSeconds: number; + partialRefreshChangePercent: number; assortSize: number; - maxPresetsCount: number; + maxPresetsPercent: number; presetPriceMult: number; blacklist: string[]; } diff --git a/Live/CWX_WeatherPatcher/server/types/models/spt/location/AirDropLootItem.d.ts b/Live/CWX_WeatherPatcher/server/types/models/spt/location/AirDropLootItem.d.ts new file mode 100644 index 0000000..da791ff --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/types/models/spt/location/AirDropLootItem.d.ts @@ -0,0 +1,6 @@ +export declare class AirDropLootItem { + id: string; + tpl: string; + isPreset: boolean; + stackCount: number; +} diff --git a/Live/CWX_WeatherPatcher/server/types/models/spt/logging/LogBackgroundColor.d.ts b/Live/CWX_WeatherPatcher/server/types/models/spt/logging/LogBackgroundColor.d.ts index 87e08a9..1dd369b 100644 --- a/Live/CWX_WeatherPatcher/server/types/models/spt/logging/LogBackgroundColor.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/models/spt/logging/LogBackgroundColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogBackgroundColor { - default = "", - black = "blackBG", - red = "redBG", - green = "greenBG", - yellow = "yellowBG", - blue = "blueBG", - magenta = "magentaBG", - cyan = "cyanBG", - white = "whiteBG" + DEFAULT = "", + BLACK = "blackBG", + RED = "redBG", + GREEN = "greenBG", + YELLOW = "yellowBG", + BLUE = "blueBG", + MAGENTA = "magentaBG", + CYAN = "cyanBG", + WHITE = "whiteBG" } diff --git a/Live/CWX_WeatherPatcher/server/types/models/spt/logging/LogTextColor.d.ts b/Live/CWX_WeatherPatcher/server/types/models/spt/logging/LogTextColor.d.ts index 7147ae3..6c7abf3 100644 --- a/Live/CWX_WeatherPatcher/server/types/models/spt/logging/LogTextColor.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/models/spt/logging/LogTextColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogTextColor { - black = "black", - red = "red", - green = "green", - yellow = "yellow", - blue = "blue", - magenta = "magenta", - cyan = "cyan", - white = "white", - gray = "" + BLACK = "black", + RED = "red", + GREEN = "green", + YELLOW = "yellow", + BLUE = "blue", + MAGENTA = "magenta", + CYAN = "cyan", + WHITE = "white", + GRAY = "" } diff --git a/Live/CWX_WeatherPatcher/server/types/models/spt/server/ILocaleBase.d.ts b/Live/CWX_WeatherPatcher/server/types/models/spt/server/ILocaleBase.d.ts index 8887c06..6e20b89 100644 --- a/Live/CWX_WeatherPatcher/server/types/models/spt/server/ILocaleBase.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/models/spt/server/ILocaleBase.d.ts @@ -13,10 +13,10 @@ export interface ILocaleGlobalBase { season: Record; customization: Record; repeatableQuest: Record; - templates: ILocaleTemplateBase; - locations: ILocaleLocationsBase; - banners: ILocaleBannersBase; - trading: ILocaleTradingBase; + templates: Record; + locations: Record; + banners: Record; + trading: Record; } export interface ILocaleQuest { name: string; @@ -31,23 +31,11 @@ export interface ILocaleQuest { export interface ILocalePreset { Name: string; } -export interface ILocaleTemplateBase { - templates: Record; -} -export interface ILocaleLocationsBase { - locations: Record; -} -export interface ILocaleBannersBase { - locations: Record; -} export interface ILocaleProps { Name: string; ShortName: string; Description: string; } -export interface ILocaleTradingBase { - locations: Record; -} export interface ILocaleTradingProps { FullName: string; FirstName: string; diff --git a/Live/CWX_WeatherPatcher/server/types/models/spt/services/LootItem.d.ts b/Live/CWX_WeatherPatcher/server/types/models/spt/services/LootItem.d.ts new file mode 100644 index 0000000..acb7606 --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/types/models/spt/services/LootItem.d.ts @@ -0,0 +1,6 @@ +export declare class LootItem { + id?: string; + tpl: string; + isPreset: boolean; + stackCount: number; +} diff --git a/Live/CWX_WeatherPatcher/server/types/models/spt/services/LootRequest.d.ts b/Live/CWX_WeatherPatcher/server/types/models/spt/services/LootRequest.d.ts new file mode 100644 index 0000000..1da8770 --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/types/models/spt/services/LootRequest.d.ts @@ -0,0 +1,11 @@ +import { MinMax } from "../../common/MinMax"; +export declare class LootRequest { + presetCount: MinMax; + itemCount: MinMax; + itemBlacklist: string[]; + itemTypeWhitelist: string[]; + /** key: item base type: value: max count */ + itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; +} diff --git a/Live/CWX_WeatherPatcher/server/types/servers/DatabaseServer.d.ts b/Live/CWX_WeatherPatcher/server/types/servers/DatabaseServer.d.ts index aa152d0..b3d29e9 100644 --- a/Live/CWX_WeatherPatcher/server/types/servers/DatabaseServer.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/servers/DatabaseServer.d.ts @@ -2,5 +2,5 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; export declare class DatabaseServer { protected tableData: IDatabaseTables; getTables(): IDatabaseTables; - setTables(any: any): void; + setTables(tableData: IDatabaseTables): void; } diff --git a/Live/CWX_WeatherPatcher/server/types/servers/RagfairServer.d.ts b/Live/CWX_WeatherPatcher/server/types/servers/RagfairServer.d.ts index bc86cdb..c93864b 100644 --- a/Live/CWX_WeatherPatcher/server/types/servers/RagfairServer.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/servers/RagfairServer.d.ts @@ -1,4 +1,6 @@ import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { TraderAssortHelper } from "../helpers/TraderAssortHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -12,11 +14,18 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected traderHelper: TraderHelper; + protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, configServer: ConfigServer); + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); load(): void; update(): void; + /** + * Get traders who need to be periodically refreshed + * @returns string array of traders + */ + protected getUpdateableTraders(): string[]; getAllCategories(): Record; getBespokeCategories(offers: IRagfairOffer[]): Record; /** diff --git a/Live/CWX_WeatherPatcher/server/types/services/BotEquipmentFilterService.d.ts b/Live/CWX_WeatherPatcher/server/types/services/BotEquipmentFilterService.d.ts index e49645b..632f961 100644 --- a/Live/CWX_WeatherPatcher/server/types/services/BotEquipmentFilterService.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/services/BotEquipmentFilterService.d.ts @@ -1,12 +1,12 @@ import { IBotType } from "../models/eft/common/tables/IBotType"; -import { Equipment, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; protected configServer: ConfigServer; protected botConfig: IBotConfig; - protected botEquipmentFilterlists: Record; + protected botEquipmentFilterlists: Record; constructor(logger: ILogger, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig @@ -22,7 +22,7 @@ export declare class BotEquipmentFilterService { * @param playerLevel Level of the player * @returns EquipmentBlacklistDetails object */ - protected getBotEquipmentBlacklist(botRole: string, playerLevel: number): EquipmentFilterDetails; + getBotEquipmentBlacklist(botRole: string, playerLevel: number): EquipmentFilterDetails; /** * Get the whitelist for a specific bot type that's within the players level * @param botRole Bot type diff --git a/Live/CWX_WeatherPatcher/server/types/services/BotGenerationCacheService.d.ts b/Live/CWX_WeatherPatcher/server/types/services/BotGenerationCacheService.d.ts new file mode 100644 index 0000000..670c583 --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/types/services/BotGenerationCacheService.d.ts @@ -0,0 +1,52 @@ +import { BotHelper } from "../helpers/BotHelper"; +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotGenerationCacheService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected botHelper: BotHelper; + protected storedBots: IBotBase[]; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); + /** + * Store array of bots in cache, shuffle results before storage + * @param botsToStore + */ + storeBots(botsToStore: IBotBase[]): void; + /** + * Find and return a bot based on its role + * Remove bot from internal array so it can't be retreived again + * @param role role to retreive (assault/bossTagilla etc) + * @returns IBotBase object + */ + getBot(role: string): IBotBase[]; + /** + * Find a bot by its index from cache + * @param indexOfBotToReturn index to find bot by + * @returns bot profile + */ + protected getBotFromCache(indexOfBotToReturn: number): IBotBase; + /** + * Remove bot profile by index from cache + * @param indexOfBotToReturn Index of bot profile to remove + */ + protected removeBotFromCache(indexOfBotToReturn: number): void; + /** + * Get index of bot profile that matches criteria + * @param role role of bot we want + * @param getPmc is requested bot a pmc + * @returns index of found bot + */ + protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; + /** + * Remove all cached bot profiles + */ + clearStoredBots(): void; + /** + * Does cache have bots + * @returns true if empty + */ + cacheIsEmpty(): boolean; +} diff --git a/Live/CWX_WeatherPatcher/server/types/services/BotLootCacheService.d.ts b/Live/CWX_WeatherPatcher/server/types/services/BotLootCacheService.d.ts index cc71eee..00ffb9c 100644 --- a/Live/CWX_WeatherPatcher/server/types/services/BotLootCacheService.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/services/BotLootCacheService.d.ts @@ -34,6 +34,17 @@ export declare class BotLootCacheService { * @param isPmc Is the bot a PMC (alteres what loot is cached) */ protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; + /** + * Sort a pool of item objects by its flea price + * @param poolToSort pool of items to sort + */ + protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void; + /** + * Add unique items into combined pool + * @param combinedItemPool Pool of items to add to + * @param itemsToAdd items to add to combined pool if unique + */ + protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void; /** * Ammo/grenades have this property * @param props diff --git a/Live/CWX_WeatherPatcher/server/types/services/FenceService.d.ts b/Live/CWX_WeatherPatcher/server/types/services/FenceService.d.ts index 79058c6..23fbf52 100644 --- a/Live/CWX_WeatherPatcher/server/types/services/FenceService.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/services/FenceService.d.ts @@ -11,29 +11,109 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; +import { ItemFilterService } from "./ItemFilterService"; +/** + * Handle actions surrounding Fence + * e.g. generating or refreshing assorts / get next refresh time + */ export declare class FenceService { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); + protected nextMiniRefreshTimestamp: number; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; - getFenceAssorts(): ITraderAssort; - hasExpiredCache(refreshAssort: boolean): boolean; - generateFenceAssortCache(pmcData: IPmcData): void; /** - * Get the fence level the passed in profile has + * Get assorts player can purchase + * Adjust prices based on fence level of player + * @param pmcProfile Player profile + * @returns ITraderAssort + */ + getFenceAssorts(pmcProfile: IPmcData): ITraderAssort; + /** + * Get fence assorts with no price adjustments based on fence rep + * @returns ITraderAssort + */ + getRawFenceAssorts(): ITraderAssort; + /** + * Does fence need to perform a partial refresh because its passed the refresh timer defined in trader.json + * @returns true if it needs a partial refresh + */ + needsPartialRefresh(): boolean; + /** + * Replace a percentage of fence assorts with freshly generated items + */ + performPartialRefresh(): void; + /** + * Increment fence next refresh timestamp by current timestamp + partialRefreshTimeSeconds from config + */ + protected incrementPartialRefreshTime(): void; + /** + * Compare the current fence offer count to what the config wants it to be, + * If value is lower add extra count to value to generate more items to fill gap + * @param existingItemCountToReplace count of items to generate + * @returns number of items to generate + */ + protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number; + /** + * Choose an item (not mod) at random and remove from assorts + */ + protected removeRandomItemFromAssorts(): void; + /** + * Get an integer rounded count of items to replace based on percentrage from traderConfig value + * @param totalItemCount total item count + * @returns rounded int of items to replace + */ + protected getCountOfItemsToReplace(totalItemCount: number): number; + /** + * Get the count of items fence offers + * @returns number + */ + getOfferCount(): number; + /** + * Create a trader assort for fence + */ + generateFenceAssortCache(): void; + /** + * Create skeleton to hold assort items + * @returns ITraderAssort object + */ + protected createBaseTraderAssortItem(): ITraderAssort; + /** + * Hydrate result parameter object with generated assorts + * @param assortCount Number of assorts to generate + * @param assorts object to add assorts to + */ + protected createAssorts(assortCount: number, assorts: ITraderAssort): void; + /** + * Get the next update timestamp for fence + * @returns future timestamp + */ + getNextFenceUpdateTimestamp(): number; + /** + * Get fence refresh time in seconds + */ + protected getFenceRefreshTime(): number; + /** + * Get fence level the passed in profile has * @param pmcData Player profile - * @returns FenceLevel + * @returns FenceLevel object */ getFenceInfo(pmcData: IPmcData): FenceLevel; + /** + * Remove an assort from fence by id + * @param assortIdToRemove assort id to remove from fence assorts + */ removeFenceOffer(assortIdToRemove: string): void; - updateFenceOffers(pmcData: IPmcData): void; } diff --git a/Live/CWX_WeatherPatcher/server/types/services/InsuranceService.d.ts b/Live/CWX_WeatherPatcher/server/types/services/InsuranceService.d.ts index 171bf10..6be8a2f 100644 --- a/Live/CWX_WeatherPatcher/server/types/services/InsuranceService.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/services/InsuranceService.d.ts @@ -2,6 +2,7 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { InsuredItem } from "../models/eft/common/tables/IBotBase"; import { Item } from "../models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; @@ -44,8 +45,22 @@ export declare class InsuranceService { * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; + /** + * Store lost gear post-raid inside profile + * @param pmcData player profile to store gear in + * @param offraidData post-raid request object + * @param preRaidGear gear player wore prior to raid + * @param sessionID Session id + */ storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string): void; storeInsuredItemsForReturn(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string): void; - protected addGearToSend(pmcData: IPmcData, insuredItem: any, actualItem: any, sessionID: string): any; + /** + * Add gear item to InsuredItems array in player profile + * @param pmcData profile to store item in + * @param insuredItem Item to store in profile + * @param actualItem item to store + * @param sessionID Session id + */ + protected addGearToSend(pmcData: IPmcData, insuredItem: InsuredItem, actualItem: Item, sessionID: string): void; getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; } diff --git a/Live/CWX_WeatherPatcher/server/types/services/ItemFilterService.d.ts b/Live/CWX_WeatherPatcher/server/types/services/ItemFilterService.d.ts new file mode 100644 index 0000000..c9c8ef3 --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/types/services/ItemFilterService.d.ts @@ -0,0 +1,24 @@ +import { IItemConfig } from "../models/spt/config/IItemConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +/** Centralise the handling of blacklisting items, uses blacklist found in config/item.json */ +export declare class ItemFilterService { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected blacklist: string[]; + protected itemConfig: IItemConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Check if the provided template id is blacklisted in config/item.json + * @param tpl template id + * @returns true if blacklisted + */ + isItemBlacklisted(tpl: string): boolean; + /** + * Return every template id blacklisted in config/item.json + * @returns string array of blacklisted tempalte ids + */ + getBlacklistedItems(): string[]; +} diff --git a/Live/CWX_WeatherPatcher/server/types/services/PmcAiService.d.ts b/Live/CWX_WeatherPatcher/server/types/services/PmcAiService.d.ts new file mode 100644 index 0000000..0690f1f --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/types/services/PmcAiService.d.ts @@ -0,0 +1,27 @@ +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +/** Storing/retreving pmcRoles set at the start of a raid - its done at that point as we know what location the player is heading to */ +export declare class PmcAiService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + protected usecRole: string; + protected bearRole: string; + constructor(logger: ILogger, configServer: ConfigServer); + /** + * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) + * @param pmcSide eft side (usec/bear) + * @returns pmc side as defined in config + */ + getPmcRole(pmcSide: "usec" | "bear" | string): string; + /** + * Set the roles for pmcs + * @param location map location to look up and use as pmc types + */ + setPmcRolesByLocation(location: string): void; + /** + * Clear the saved role from usec/bear PMCs + */ + clearPmcRoles(): void; +} diff --git a/Live/CWX_WeatherPatcher/server/types/services/ProfileFixerService.d.ts b/Live/CWX_WeatherPatcher/server/types/services/ProfileFixerService.d.ts index ed1dec7..9cb5a38 100644 --- a/Live/CWX_WeatherPatcher/server/types/services/ProfileFixerService.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/services/ProfileFixerService.d.ts @@ -45,6 +45,11 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to find and remove slots from */ protected removeResourcesFromSlotsInHideoutWithoutLocationIndexValue(pmcProfile: IPmcData): void; + /** + * Hideout slots need to be in a specific order, locationIndex in ascending order + * @param pmcProfile profile to edit + */ + protected reorderHideoutAreasWithResouceInputs(pmcProfile: IPmcData): void; /** * add in objects equal to the number of slots * @param areaType area to check diff --git a/Live/CWX_WeatherPatcher/server/types/services/ProfileSnapshotService.d.ts b/Live/CWX_WeatherPatcher/server/types/services/ProfileSnapshotService.d.ts new file mode 100644 index 0000000..445ffd0 --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/types/services/ProfileSnapshotService.d.ts @@ -0,0 +1,30 @@ +import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { JsonUtil } from "../utils/JsonUtil"; +export declare class ProfileSnapshotService { + protected jsonUtil: JsonUtil; + protected storedProfileSnapshots: Record; + constructor(jsonUtil: JsonUtil); + /** + * Store a profile into an in-memory object + * @param sessionID session id - acts as the key + * @param profile - profile to save + */ + storeProfileSnapshot(sessionID: string, profile: IAkiProfile): void; + /** + * Retreve a stored profile + * @param sessionID key + * @returns A player profile object + */ + getProfileSnapshot(sessionID: string): IAkiProfile; + /** + * Does a profile exists against the provided key + * @param sessionID key + * @returns true if exists + */ + hasProfileSnapshot(sessionID: string): boolean; + /** + * Remove a stored profile by key + * @param sessionID key + */ + clearProfileSnapshot(sessionID: string): void; +} diff --git a/Live/CWX_WeatherPatcher/server/types/services/RagfairOfferService.d.ts b/Live/CWX_WeatherPatcher/server/types/services/RagfairOfferService.d.ts index 7398a8f..f9e3a34 100644 --- a/Live/CWX_WeatherPatcher/server/types/services/RagfairOfferService.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/services/RagfairOfferService.d.ts @@ -24,7 +24,6 @@ export declare class RagfairOfferService { protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected toUpdate: Record; protected expiredOffers: Item[]; protected offers: IRagfairOffer[]; protected ragfairConfig: IRagfairConfig; @@ -38,8 +37,6 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; - setTraderUpdateStatus(traderId: string, shouldUpdate: boolean): void; - shouldTraderBeUpdated(traderID: string): boolean; getExpiredOfferCount(): number; /** * Get an array of expired items not yet processed into new offers @@ -53,12 +50,15 @@ export declare class RagfairOfferService { * @returns offer exists - true */ doesOfferExist(offerId: string): boolean; - getTraders(): Record; - flagTraderForUpdate(expiredOfferUserId: string): void; removeOfferById(offerId: string): void; removeOfferStack(offerID: string, amount: number): void; removeAllOffersByTrader(traderId: string): void; - addTradersToUpdateList(): void; + /** + * Do the trader offers on flea need to be refreshed + * @param traderID Trader to check + * @returns true if they do + */ + traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; /** diff --git a/Live/CWX_WeatherPatcher/server/types/services/RagfairPriceService.d.ts b/Live/CWX_WeatherPatcher/server/types/services/RagfairPriceService.d.ts index 679fe1d..466c9e3 100644 --- a/Live/CWX_WeatherPatcher/server/types/services/RagfairPriceService.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/services/RagfairPriceService.d.ts @@ -27,6 +27,20 @@ export declare class RagfairPriceService { getDynamicPrice(itemTpl: string): number; getAllFleaPrices(): Record; getFleaPriceForItem(tplId: string): number; + /** + * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * @param itemPrice price of item + * @param itemTpl item template Id being checked + * @returns adjusted price value in roubles + */ + protected adjustPriceIfBelowHandbook(itemPrice: number, itemTpl: string): number; + /** + * Get the percentage difference between two values + * @param a numerical value a + * @param b numerical value b + * @returns different in percent + */ + protected getPriceDifference(a: number, b: number): number; getStaticPriceForItem(tplId: string): number; getBarterPrice(barterScheme: IBarterScheme[]): number; getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; diff --git a/Live/CWX_WeatherPatcher/server/types/services/RepairService.d.ts b/Live/CWX_WeatherPatcher/server/types/services/RepairService.d.ts new file mode 100644 index 0000000..3e6077c --- /dev/null +++ b/Live/CWX_WeatherPatcher/server/types/services/RepairService.d.ts @@ -0,0 +1,75 @@ +import { QuestHelper } from "../helpers/QuestHelper"; +import { RepairHelper } from "../helpers/RepairHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { RepairKitsInfo } from "../models/eft/repair/IRepairActionDataRequest"; +import { RepairItem } from "../models/eft/repair/ITraderRepairActionDataRequest"; +import { IRepairConfig } from "../models/spt/config/IRepairConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ItemEventRouter } from "../routers/ItemEventRouter"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { PaymentService } from "./PaymentService"; +export declare class RepairService { + protected logger: ILogger; + protected itemEventRouter: ItemEventRouter; + protected databaseServer: DatabaseServer; + protected questHelper: QuestHelper; + protected traderHelper: TraderHelper; + protected paymentService: PaymentService; + protected repairHelper: RepairHelper; + protected configServer: ConfigServer; + repairConfig: IRepairConfig; + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + /** + * Use trader to repair an items durability + * @param sessionID Session id + * @param pmcData profile to find item to repair in + * @param repairItemDetails details of the item to repair + * @param traderId Trader being used to repair item + * @returns RepairDetails object + */ + repairItemByTrader(sessionID: string, pmcData: IPmcData, repairItemDetails: RepairItem, traderId: string): RepairDetails; + /** + * + * @param sessionID Session id + * @param pmcData profile to take money from + * @param repairedItemId Repaired item id + * @param repairCost Cost to repair item in roubles + * @param traderId Id of the trader who repaired the item / who is paid + * @param output + */ + payForRepair(sessionID: string, pmcData: IPmcData, repairedItemId: string, repairCost: number, traderId: string, output: IItemEventRouterResponse): void; + /** + * Add skill points to profile after repairing an item + * @param sessionId Session id + * @param repairDetails details of item repaired, cost/item + * @param pmcData Profile to add points to + * @param output IItemEventRouterResponse + */ + addRepairSkillPoints(sessionId: string, repairDetails: RepairDetails, pmcData: IPmcData, output: IItemEventRouterResponse): void; + /** + * + * @param sessionId Session id + * @param pmcData Profile to update repaired item in + * @param repairKits Array of Repair kits to use + * @param itemToRepairId Item id to repair + * @param output IItemEventRouterResponse + * @returns Details of repair, item/price + */ + repairItemByKit(sessionId: string, pmcData: IPmcData, repairKits: RepairKitsInfo[], itemToRepairId: string, output: IItemEventRouterResponse): RepairDetails; + /** + * Update repair kits Resource object if it doesn't exist + * @param repairKitDetails Repair kit details from db + * @param repairKitInInventory Repair kit to update + */ + protected addMaxResourceToKitIfMissing(repairKitDetails: ITemplateItem, repairKitInInventory: Item): void; +} +export declare class RepairDetails { + repairCost?: number; + repairedItem: Item; + repairedItemIsArmor: boolean; +} diff --git a/Live/CWX_WeatherPatcher/server/types/services/TraderAssortService.d.ts b/Live/CWX_WeatherPatcher/server/types/services/TraderAssortService.d.ts index 5ba2d05..03b4e12 100644 --- a/Live/CWX_WeatherPatcher/server/types/services/TraderAssortService.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/services/TraderAssortService.d.ts @@ -2,5 +2,10 @@ import { ITraderAssort } from "../models/eft/common/tables/ITrader"; export declare class TraderAssortService { protected pristineTraderAssorts: Record; getPristineTraderAssort(traderId: string): ITraderAssort; + /** + * Store trader assorts inside a class property + * @param traderId Traderid to store assorts against + * @param assort Assorts to store + */ setPristineTraderAssort(traderId: string, assort: ITraderAssort): void; } diff --git a/Live/CWX_WeatherPatcher/server/types/utils/HashUtil.d.ts b/Live/CWX_WeatherPatcher/server/types/utils/HashUtil.d.ts index bacbf2a..a8500e1 100644 --- a/Live/CWX_WeatherPatcher/server/types/utils/HashUtil.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/utils/HashUtil.d.ts @@ -4,8 +4,18 @@ import { TimeUtil } from "./TimeUtil"; export declare class HashUtil { protected timeUtil: TimeUtil; constructor(timeUtil: TimeUtil); + /** + * Create a 24 character id using the sha256 algorithm + current timestamp + * @returns 24 character hash + */ generate(): string; generateMd5ForData(data: string): string; generateSha1ForData(data: string): string; + /** + * Create a hash for the data parameter + * @param algorithm algorithm to use to hash + * @param data data to be hashed + * @returns hash value + */ generateHashForData(algorithm: string, data: crypto.BinaryLike): string; } diff --git a/Live/CWX_WeatherPatcher/server/types/utils/RandomUtil.d.ts b/Live/CWX_WeatherPatcher/server/types/utils/RandomUtil.d.ts index c24dd60..633e472 100644 --- a/Live/CWX_WeatherPatcher/server/types/utils/RandomUtil.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/utils/RandomUtil.d.ts @@ -136,7 +136,7 @@ export declare class RandomUtil { * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with ot without replacement from the input array + * @param {boolean} replacement Draw with or without replacement from the input array * @return {array} Array consisting of N random elements */ drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; @@ -150,4 +150,10 @@ export declare class RandomUtil { */ drawRandomFromDict(dict: any, count?: number, replacement?: boolean): any[]; getBiasedRandomNumber(min: number, max: number, shift: number, n: number): number; + /** + * Fisher-Yates shuffle an array + * @param array Array to shuffle + * @returns Shuffled array + */ + shuffle(array: Array): Array; } diff --git a/Live/CWX_WeatherPatcher/server/types/utils/TimeUtil.d.ts b/Live/CWX_WeatherPatcher/server/types/utils/TimeUtil.d.ts index eed4e6d..1367e26 100644 --- a/Live/CWX_WeatherPatcher/server/types/utils/TimeUtil.d.ts +++ b/Live/CWX_WeatherPatcher/server/types/utils/TimeUtil.d.ts @@ -1,9 +1,16 @@ +/** + * Utility class to handle time related problems + */ export declare class TimeUtil { static readonly oneHourAsSeconds = 3600; formatTime(date: Date): string; formatDate(date: Date): string; getDate(): string; getTime(): string; + /** + * Get timestamp in seconds + * @returns + */ getTimestamp(): number; /** * mail in eft requires time be in a specific format @@ -15,4 +22,10 @@ export declare class TimeUtil { * @returns current date in format: 00.00.0000 (dd.mm.yyyy) */ getDateMailFormat(): string; + /** + * Convert hours into seconds + * @param hours hours to convert to seconds + * @returns number + */ + getHoursAsSeconds(hours: number): number; }