From 3e83b2ee9972c4ba2003e4530ef14e58024e21a8 Mon Sep 17 00:00:00 2001 From: Chomp Date: Fri, 25 Nov 2022 22:49:38 +0000 Subject: [PATCH] 3.4.0 update --- .../types/callbacks/DialogueCallbacks.d.ts | 2 +- .../types/callbacks/HandbookCallbacks.d.ts | 2 +- .../types/callbacks/HideoutCallbacks.d.ts | 2 +- .../types/callbacks/HttpCallbacks.d.ts | 2 +- .../types/callbacks/InsuranceCallbacks.d.ts | 2 +- .../types/callbacks/ModCallbacks.d.ts | 6 +- .../types/callbacks/PresetCallbacks.d.ts | 2 +- .../types/callbacks/RagfairCallbacks.d.ts | 8 +-- .../types/callbacks/SaveCallbacks.d.ts | 4 +- .../types/callbacks/TraderCallbacks.d.ts | 4 +- .../types/controllers/BotController.d.ts | 16 ++++- .../controllers/CustomizationController.d.ts | 4 +- .../types/controllers/GameController.d.ts | 4 ++ .../types/controllers/HealthController.d.ts | 12 ++-- .../types/controllers/MatchController.d.ts | 6 +- .../types/controllers/QuestController.d.ts | 12 +++- .../types/controllers/RagfairController.d.ts | 6 +- .../RepeatableQuestController.d.ts | 7 +++ TypeScript/1LogToConsole/types/di/OnLoad.d.ts | 2 +- .../types/di/OnLoadOnUpdate.d.ts | 4 +- .../1LogToConsole/types/di/OnUpdate.d.ts | 2 +- .../types/generators/BotGenerator.d.ts | 63 ++++++------------- .../generators/BotInventoryGenerator.d.ts | 35 +++++++---- .../types/generators/BotLevelGenerator.d.ts | 29 +++++++++ .../types/generators/BotLootGenerator.d.ts | 15 ++++- .../types/generators/BotWeaponGenerator.d.ts | 4 +- .../types/generators/LocationGenerator.d.ts | 4 +- .../types/generators/LootGenerator.d.ts | 4 +- .../types/generators/PlayerScavGenerator.d.ts | 4 +- .../generators/RagfairOfferGenerator.d.ts | 13 +++- .../types/helpers/BotGeneratorHelper.d.ts | 19 +++++- .../types/helpers/BotHelper.d.ts | 28 ++++++++- .../helpers/BotWeaponGeneratorHelper.d.ts | 4 +- .../types/helpers/DialogueHelper.d.ts | 4 +- .../types/helpers/HandbookHelper.d.ts | 1 + .../types/helpers/ItemHelper.d.ts | 8 ++- .../types/helpers/QuestHelper.d.ts | 4 +- .../types/helpers/RagfairOfferHelper.d.ts | 4 +- .../types/helpers/TraderAssortHelper.d.ts | 4 +- .../types/loaders/PostDBModLoader.d.ts | 2 +- .../eft/bot/IRandomisedBotLevelResult.d.ts | 4 ++ .../models/eft/common/tables/IBotBase.d.ts | 1 - .../models/eft/common/tables/IQuest.d.ts | 2 +- .../eft/customization/IGetSuitsResponse.d.ts | 2 +- .../types/models/enums/ExitStatis.d.ts | 7 +++ .../models/spt/bots/BotGenerationDetails.d.ts | 18 ++++++ .../types/models/spt/config/IBotConfig.d.ts | 17 ++++- .../models/spt/config/ILocationConfig.d.ts | 8 +++ .../types/models/spt/config/IPmcConfig.d.ts | 1 + .../types/routers/ItemEventRouter.d.ts | 10 +-- .../types/servers/RagfairServer.d.ts | 8 ++- .../services/BotEquipmentFilterService.d.ts | 24 ++++--- .../services/BotGenerationCacheService.d.ts | 16 ++--- .../types/services/BotLootCacheService.d.ts | 4 +- .../services/CustomLocationWaveService.d.ts | 42 +++++++++++++ .../types/services/FenceService.d.ts | 4 +- .../types/services/InsuranceService.d.ts | 4 +- .../types/services/ItemBaseClassService.d.ts | 37 +++++++++++ .../types/services/OpenZoneService.d.ts | 28 +++++++++ .../types/services/RagfairOfferService.d.ts | 14 ++--- .../types/services/RagfairPriceService.d.ts | 2 +- .../services/RagfairRequiredItemsService.d.ts | 2 +- .../types/services/mod/onLoad/OnLoadMod.d.ts | 2 +- .../services/mod/onUpdate/OnUpdateMod.d.ts | 2 +- TypeScript/1LogToConsole/types/utils/App.d.ts | 4 +- .../types/utils/DatabaseImporter.d.ts | 6 +- .../1LogToConsole/types/utils/JsonUtil.d.ts | 1 + .../1LogToConsole/types/utils/Logger.d.ts | 6 ++ .../types/utils/RagfairOfferHolder.d.ts | 24 +++++++ .../1LogToConsole/types/utils/Watermark.d.ts | 6 +- readme.md | 2 +- 71 files changed, 507 insertions(+), 159 deletions(-) create mode 100644 TypeScript/1LogToConsole/types/generators/BotLevelGenerator.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/eft/bot/IRandomisedBotLevelResult.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/enums/ExitStatis.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/spt/bots/BotGenerationDetails.d.ts create mode 100644 TypeScript/1LogToConsole/types/services/CustomLocationWaveService.d.ts create mode 100644 TypeScript/1LogToConsole/types/services/ItemBaseClassService.d.ts create mode 100644 TypeScript/1LogToConsole/types/services/OpenZoneService.d.ts create mode 100644 TypeScript/1LogToConsole/types/utils/RagfairOfferHolder.d.ts diff --git a/TypeScript/1LogToConsole/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/DialogueCallbacks.d.ts index 7b2eeae..581c980 100644 --- a/TypeScript/1LogToConsole/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/DialogueCallbacks.d.ts @@ -52,6 +52,6 @@ export declare class DialogueCallbacks extends OnUpdate { listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; friendRequest(url: string, request: IFriendRequestData, sessionID: string): INullResponseData; sendMessage(url: string, request: ISendMessageRequest, sessionID: string): IGetBodyResponseData; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/1LogToConsole/types/callbacks/HandbookCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/HandbookCallbacks.d.ts index 891e375..1bb6241 100644 --- a/TypeScript/1LogToConsole/types/callbacks/HandbookCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/HandbookCallbacks.d.ts @@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad"; export declare class HandbookCallbacks extends OnLoad { protected handbookController: HandbookController; constructor(handbookController: HandbookController); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/1LogToConsole/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/HideoutCallbacks.d.ts index e39e806..56450a9 100644 --- a/TypeScript/1LogToConsole/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/HideoutCallbacks.d.ts @@ -91,6 +91,6 @@ export declare class HideoutCallbacks extends OnUpdate { * @returns */ takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/1LogToConsole/types/callbacks/HttpCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/HttpCallbacks.d.ts index 43928a1..299a32c 100644 --- a/TypeScript/1LogToConsole/types/callbacks/HttpCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/HttpCallbacks.d.ts @@ -3,7 +3,7 @@ import { HttpServer } from "../servers/HttpServer"; export declare class HttpCallbacks extends OnLoad { protected httpServer: HttpServer; constructor(httpServer: HttpServer); - onLoad(): void; + onLoad(): Promise; getRoute(): string; getImage(): string; } diff --git a/TypeScript/1LogToConsole/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/InsuranceCallbacks.d.ts index a171e1c..11aef4a 100644 --- a/TypeScript/1LogToConsole/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/InsuranceCallbacks.d.ts @@ -27,6 +27,6 @@ export declare class InsuranceCallbacks extends OnUpdate { * @returns IItemEventRouterResponse */ insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(secondsSinceLastRun: number): boolean; + onUpdate(secondsSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/1LogToConsole/types/callbacks/ModCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/ModCallbacks.d.ts index aec2f59..9ebb750 100644 --- a/TypeScript/1LogToConsole/types/callbacks/ModCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/ModCallbacks.d.ts @@ -3,6 +3,7 @@ import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class ModCallbacks extends OnLoad { @@ -10,10 +11,11 @@ declare class ModCallbacks extends OnLoad { protected httpResponse: HttpResponseUtil; protected httpFileUtil: HttpFileUtil; protected postAkiModLoader: PostAkiModLoader; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); - onLoad(): void; + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, localisationService: LocalisationService, configServer: ConfigServer); + onLoad(): Promise; getRoute(): string; sendBundle(sessionID: string, req: any, resp: any, body: any): void; getBundles(url: string, info: any, sessionID: string): string; diff --git a/TypeScript/1LogToConsole/types/callbacks/PresetCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/PresetCallbacks.d.ts index 4553f8f..681bb99 100644 --- a/TypeScript/1LogToConsole/types/callbacks/PresetCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/PresetCallbacks.d.ts @@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad"; export declare class PresetCallbacks extends OnLoad { protected presetController: PresetController; constructor(presetController: PresetController); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/1LogToConsole/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/RagfairCallbacks.d.ts index 37f3807..15597bf 100644 --- a/TypeScript/1LogToConsole/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/RagfairCallbacks.d.ts @@ -14,7 +14,6 @@ import { IRemoveOfferRequestData } from "../models/eft/ragfair/IRemoveOfferReque import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; import { ISendRagfairReportRequestData } from "../models/eft/ragfair/ISendRagfairReportRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -24,14 +23,13 @@ import { JsonUtil } from "../utils/JsonUtil"; */ export declare class RagfairCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; - protected logger: ILogger; protected jsonUtil: JsonUtil; protected ragfairServer: RagfairServer; protected ragfairController: RagfairController; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(httpResponse: HttpResponseUtil, logger: ILogger, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer); - onLoad(): void; + constructor(httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer); + onLoad(): Promise; getRoute(): string; search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData; getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; @@ -39,6 +37,6 @@ export declare class RagfairCallbacks extends OnLoadOnUpdate { addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; sendReport(url: string, info: ISendRagfairReportRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/1LogToConsole/types/callbacks/SaveCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/SaveCallbacks.d.ts index bbb6e53..ab29ddc 100644 --- a/TypeScript/1LogToConsole/types/callbacks/SaveCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/SaveCallbacks.d.ts @@ -3,7 +3,7 @@ import { SaveServer } from "../servers/SaveServer"; export declare class SaveCallbacks extends OnLoadOnUpdate { protected saveServer: SaveServer; constructor(saveServer: SaveServer); - onLoad(): void; + onLoad(): Promise; getRoute(): string; - onUpdate(secondsSinceLastRun: number): boolean; + onUpdate(secondsSinceLastRun: number): Promise; } diff --git a/TypeScript/1LogToConsole/types/callbacks/TraderCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/TraderCallbacks.d.ts index 40a1455..1efde87 100644 --- a/TypeScript/1LogToConsole/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/TraderCallbacks.d.ts @@ -8,8 +8,8 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); - onLoad(): void; - onUpdate(): boolean; + onLoad(): Promise; + onUpdate(): Promise; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** diff --git a/TypeScript/1LogToConsole/types/controllers/BotController.d.ts b/TypeScript/1LogToConsole/types/controllers/BotController.d.ts index 92317c3..a80aaed 100644 --- a/TypeScript/1LogToConsole/types/controllers/BotController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/BotController.d.ts @@ -2,6 +2,7 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; import { IBotBase } from "../models/eft/common/tables/IBotBase"; @@ -23,18 +24,23 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; + protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for - * @returns + * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; + /** + * Get the core.json difficulty settings from database\bots + * @returns IBotCore + */ getBotCoreDifficulty(): IBotCore; /** * Get bot difficulty settings @@ -51,6 +57,12 @@ export declare class BotController { * @returns IBotBase array */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * @param requestedDifficulty + * @returns + */ + getPMCDifficulty(requestedDifficulty: string): string; /** * Get the max number of bots allowed on a map * Looks up location player is entering when getting cap value diff --git a/TypeScript/1LogToConsole/types/controllers/CustomizationController.d.ts b/TypeScript/1LogToConsole/types/controllers/CustomizationController.d.ts index 5fe51e3..a4ef8cf 100644 --- a/TypeScript/1LogToConsole/types/controllers/CustomizationController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/CustomizationController.d.ts @@ -8,13 +8,15 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; export declare class CustomizationController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected saveServer: SaveServer; + protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/1LogToConsole/types/controllers/GameController.d.ts b/TypeScript/1LogToConsole/types/controllers/GameController.d.ts index f4f5849..d8f2e67 100644 --- a/TypeScript/1LogToConsole/types/controllers/GameController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/GameController.d.ts @@ -34,6 +34,10 @@ export declare class GameController { protected coreConfig: ICoreConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, gameEventHelper: GameEventHelper, applicationContext: ApplicationContext, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + /** + * Blank out the "test" mail message from prapor + */ + protected removePraporTestMessage(): void; /** * Check if current date falls inside any of the seasons events pased in, if so, handle them * @param seasonalEvents events to check for diff --git a/TypeScript/1LogToConsole/types/controllers/HealthController.d.ts b/TypeScript/1LogToConsole/types/controllers/HealthController.d.ts index ce67993..97cf7ef 100644 --- a/TypeScript/1LogToConsole/types/controllers/HealthController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/HealthController.d.ts @@ -1,23 +1,25 @@ -import { ItemHelper } from "../helpers/ItemHelper"; -import { PaymentService } from "../services/PaymentService"; -import { InventoryHelper } from "../helpers/InventoryHelper"; import { HealthHelper } from "../helpers/HealthHelper"; +import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IHealthTreatmentRequestData } from "../models/eft/health/IHealthTreatmentRequestData"; import { IOffraidEatRequestData } from "../models/eft/health/IOffraidEatRequestData"; import { IOffraidHealRequestData } from "../models/eft/health/IOffraidHealRequestData"; import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; export declare class HealthController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected healthHelper: HealthHelper; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, healthHelper: HealthHelper); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, localisationService: LocalisationService, healthHelper: HealthHelper); /** * stores in-raid player health * @param pmcData Player profile diff --git a/TypeScript/1LogToConsole/types/controllers/MatchController.d.ts b/TypeScript/1LogToConsole/types/controllers/MatchController.d.ts index 2b0d150..2c78405 100644 --- a/TypeScript/1LogToConsole/types/controllers/MatchController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/MatchController.d.ts @@ -18,7 +18,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; +import { CustomLocationWaveService } from "../services/CustomLocationWaveService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { OpenZoneService } from "../services/OpenZoneService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { protected logger: ILogger; @@ -29,12 +31,14 @@ export declare class MatchController { protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; + protected customLocationWaveService: CustomLocationWaveService; + protected openZoneService: OpenZoneService; protected botGenerationCacheService: BotGenerationCacheService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; protected botConfig: IBotConfig; - constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/1LogToConsole/types/controllers/QuestController.d.ts b/TypeScript/1LogToConsole/types/controllers/QuestController.d.ts index 842207f..59061c7 100644 --- a/TypeScript/1LogToConsole/types/controllers/QuestController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/QuestController.d.ts @@ -5,6 +5,7 @@ import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IQuest, Reward } from "../models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "../models/eft/quests/ICompleteQuestRequestData"; @@ -15,6 +16,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { TimeUtil } from "../utils/TimeUtil"; export declare class QuestController { @@ -29,9 +31,10 @@ export declare class QuestController { protected questConditionHelper: QuestConditionHelper; protected playerService: PlayerService; protected localeService: LocaleService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all quests visible to player * Exclude quests with incomplete preconditions (level/loyalty) @@ -56,6 +59,13 @@ export declare class QuestController { */ acceptQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; acceptRepeatableQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Look for an accepted quest inside player profile, return matching + * @param pmcData Profile to search through + * @param acceptedQuest Quest to search for + * @returns IRepeatableQuest + */ + protected getRepeatableQuestFromProfile(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData): IRepeatableQuest; /** * Update completed quest in profile * Add newly unlocked quests to profile diff --git a/TypeScript/1LogToConsole/types/controllers/RagfairController.d.ts b/TypeScript/1LogToConsole/types/controllers/RagfairController.d.ts index 95702f2..5caac53 100644 --- a/TypeScript/1LogToConsole/types/controllers/RagfairController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/RagfairController.d.ts @@ -67,16 +67,16 @@ export declare class RagfairController { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, 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, localisationService: LocalisationService, configServer: ConfigServer); - getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + getOffers(sessionID: string, searchRequest: ISearchRequestData): IGetOffersResult; /** * Get offers for the client based on type of search being performed * @param searchRequest Client search request data * @param itemsToAdd - * @param assorts + * @param traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers */ - protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data diff --git a/TypeScript/1LogToConsole/types/controllers/RepeatableQuestController.d.ts b/TypeScript/1LogToConsole/types/controllers/RepeatableQuestController.d.ts index 333583b..f97efc6 100644 --- a/TypeScript/1LogToConsole/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/RepeatableQuestController.d.ts @@ -98,6 +98,13 @@ export declare class RepeatableQuestController { * @returns {array} array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; + /** + * Get repeatable quest data from profile from name (daily/weekly), creates base repeatable quest object if none exists + * @param repeatableConfig daily/weekly config + * @param pmcData Profile to search + * @returns IPmcDataRepeatableQuest + */ + protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; /** * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest diff --git a/TypeScript/1LogToConsole/types/di/OnLoad.d.ts b/TypeScript/1LogToConsole/types/di/OnLoad.d.ts index 064d07d..4a28f13 100644 --- a/TypeScript/1LogToConsole/types/di/OnLoad.d.ts +++ b/TypeScript/1LogToConsole/types/di/OnLoad.d.ts @@ -1,4 +1,4 @@ export declare class OnLoad { - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/1LogToConsole/types/di/OnLoadOnUpdate.d.ts b/TypeScript/1LogToConsole/types/di/OnLoadOnUpdate.d.ts index 8bd3dc3..eaa297c 100644 --- a/TypeScript/1LogToConsole/types/di/OnLoadOnUpdate.d.ts +++ b/TypeScript/1LogToConsole/types/di/OnLoadOnUpdate.d.ts @@ -1,7 +1,7 @@ import { OnLoad } from "./OnLoad"; import { OnUpdate } from "./OnUpdate"; export declare class OnLoadOnUpdate implements OnLoad, OnUpdate { - onUpdate(timeSinceLastRun: number): boolean; - onLoad(): void; + onUpdate(timeSinceLastRun: number): Promise; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/1LogToConsole/types/di/OnUpdate.d.ts b/TypeScript/1LogToConsole/types/di/OnUpdate.d.ts index 7fbbe09..6839719 100644 --- a/TypeScript/1LogToConsole/types/di/OnUpdate.d.ts +++ b/TypeScript/1LogToConsole/types/di/OnUpdate.d.ts @@ -1,4 +1,4 @@ export declare class OnUpdate { - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/1LogToConsole/types/generators/BotGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/BotGenerator.d.ts index a1ac9ed..5bf52f1 100644 --- a/TypeScript/1LogToConsole/types/generators/BotGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/BotGenerator.d.ts @@ -5,6 +5,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -14,12 +15,7 @@ import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotInventoryGenerator } from "./BotInventoryGenerator"; -declare namespace BotGenerator { - interface IRandomisedBotLevelResult { - level: number; - exp: number; - } -} +import { BotLevelGenerator } from "./BotLevelGenerator"; export declare class BotGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -28,6 +24,7 @@ export declare class BotGenerator { protected profileHelper: ProfileHelper; protected databaseServer: DatabaseServer; protected botInventoryGenerator: BotInventoryGenerator; + protected botLevelGenerator: BotLevelGenerator; protected botEquipmentFilterService: BotEquipmentFilterService; protected weightedRandomHelper: WeightedRandomHelper; protected botHelper: BotHelper; @@ -35,7 +32,7 @@ export declare class BotGenerator { protected gameEventHelper: GameEventHelper; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botLevelGenerator: BotLevelGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -45,23 +42,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Generate an array of bot objects based on a condition for a raid with - * @param sessionId session id - * @param condition request condition - * @returns bot array + * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * @param sessionId Session id + * @param botGenerationDetails details on how to generate bots + * @returns array of bots */ - generateByCondition(sessionId: string, botCountToGenerate: number, difficulty: string, role: string, isPmc: boolean): IBotBase[]; - /** - * Get the PMCs wildSpawnType value - * @param role "usec" / "bear" - * @returns wildSpawnType value as string - */ - protected getPmcRoleByDescription(role: string): string; - /** - * Get a randomised PMC side based on bot config value 'isUsec' - * @returns pmc side as string - */ - protected getRandomisedPmcSide(): string; + prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -71,26 +57,24 @@ export declare class BotGenerator { * Create a IBotBase object with equipment/loot/exp etc * @param sessionId Session id * @param bot bots base file - * @param botRole Role bot will use (bear/usec for PMCs) - * @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 + * @param botJsonTemplate Bot template from db/bots/x.json + * @param botGenerationDetails details on how to generate the bot * @returns IBotBase object */ - protected generateBot(sessionId: string, bot: IBotBase, botRole: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + protected generateBot(sessionId: string, bot: IBotBase, botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails): IBotBase; + /** + * Create a bot nickname + * @param botJsonTemplate x.json from database + * @param isPlayerScav Will bot be player scav + * @param botRole role of bot e.g. assault + * @returns Nickname for bot + */ + protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string): string; /** * 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; - /** - * 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 @@ -111,12 +95,6 @@ export declare class BotGenerator { */ 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 * @param bot bot to add dogtag to @@ -124,4 +102,3 @@ export declare class BotGenerator { */ protected generateDogtag(bot: IBotBase): IBotBase; } -export {}; diff --git a/TypeScript/1LogToConsole/types/generators/BotInventoryGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/BotInventoryGenerator.d.ts index e1efaf2..a3b5eaa 100644 --- a/TypeScript/1LogToConsole/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/BotInventoryGenerator.d.ts @@ -1,9 +1,10 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotHelper } from "../helpers/BotHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Generation, Inventory, Mods } from "../models/eft/common/tables/IBotType"; +import { Chances, Generation, IBotType, Inventory, Mods } from "../models/eft/common/tables/IBotType"; import { EquipmentSlots } from "../models/enums/EquipmentSlots"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -20,22 +21,22 @@ export declare class BotInventoryGenerator { protected botWeaponGenerator: BotWeaponGenerator; protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; + protected botHelper: BotHelper; protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, botHelper: BotHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances each item will be added to bot - * @param itemGenerationLimitsMinMax item gen limits for bot role + * @param botJsonTemplate bot/x.json data from db * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc + * @param botLevel Level of bot being generated * @returns PmcInventory object with equipment/weapons/loot */ - generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + generateInventory(sessionId: string, botJsonTemplate: IBotType, botRole: string, isPmc: boolean, botLevel: number): PmcInventory; /** * Create a pmcInventory object with all the base/generic items needed * @returns PmcInventory object @@ -47,9 +48,20 @@ export declare class BotInventoryGenerator { * @param equipmentChances Chances items will be added to bot * @param botRole Role bot has (assault/pmcBot) * @param botInventory Inventory to add equipment to + * @param botLevel Level of bot */ - protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory): void; - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Add a piece of equipment with mods to inventory from the provided pools + * @param equipmentSlot Slot to select an item for + * @param equipmentPool Possible items to choose from + * @param modPool Possible mods to apply to item chosen + * @param spawnChances Chances items will be chosen to be added + * @param botRole Role of bot e.g. assault + * @param inventory Inventory to add item into + * @param randomisationDetails settings from bot.json to adjust how item is generated + */ + protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; /** * Work out what weapons bot should have equipped and add them to bot inventory * @param templateInventory bot/x.json data from db @@ -58,9 +70,10 @@ export declare class BotInventoryGenerator { * @param botInventory Inventory to add weapons to * @param botRole assault/pmcBot/bossTagilla etc * @param isPmc Is the bot being generated as a pmc + * @param botLevel level of bot having weapon generated * @param itemGenerationLimitsMinMax Limits for items the bot can have */ - protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void; /** * Calculate if the bot should have weapons in Primary/Secondary/Holster slots * @param equipmentChances Chances bot has certain equipment @@ -84,5 +97,5 @@ export declare class BotInventoryGenerator { protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; - }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void; } diff --git a/TypeScript/1LogToConsole/types/generators/BotLevelGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/BotLevelGenerator.d.ts new file mode 100644 index 0000000..751e6e6 --- /dev/null +++ b/TypeScript/1LogToConsole/types/generators/BotLevelGenerator.d.ts @@ -0,0 +1,29 @@ +import { MinMax } from "../models/common/MinMax"; +import { IRandomisedBotLevelResult } from "../models/eft/bot/IRandomisedBotLevelResult"; +import { ExpTable } from "../models/eft/common/IGlobals"; +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotLevelGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer); + /** + * Return a randomised bot level and exp value + * @param levelDetails min and max of level for bot + * @param botGenerationDetails Deatils to help generate a bot + * @param bot being level is being generated for + * @returns IRandomisedBotLevelResult object + */ + generateBotLevel(levelDetails: MinMax, botGenerationDetails: BotGenerationDetails, bot: IBotBase): IRandomisedBotLevelResult; + /** + * Get the highest level a bot can be relative to the players level, but no futher than the max size from globals.exp_table + * @param playerLevel Players current level + * @param relativeDeltaMax max delta above player level to go + * @returns highest level possible for bot + */ + protected getHighestRelativeBotLevel(playerLevel: number, relativeDeltaMax: number, levelDetails: MinMax, expTable: ExpTable[]): number; +} diff --git a/TypeScript/1LogToConsole/types/generators/BotLootGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/BotLootGenerator.d.ts index 3352a46..6273a11 100644 --- a/TypeScript/1LogToConsole/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/BotLootGenerator.d.ts @@ -28,7 +28,18 @@ export declare class BotLootGenerator { protected configServer: ConfigServer; protected botConfig: IBotConfig; constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; + /** + * Add loot to bots containers + * @param sessionId Session id + * @param templateInventory x.json from database/bots + * @param itemCounts Liits on item types to be added as loot + * @param isPmc Will bot be a pmc + * @param botRole Role of bot, e.g. asssult + * @param botInventory Inventory to add loot to + * @param equipmentChances + * @param botLevel Level of bot + */ + generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): 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 @@ -51,7 +62,7 @@ export declare class BotLootGenerator { * @param botRole bots role, .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, 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, botLevel: number): 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/TypeScript/1LogToConsole/types/generators/BotWeaponGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/BotWeaponGenerator.d.ts index 40284ea..b2eaf3b 100644 --- a/TypeScript/1LogToConsole/types/generators/BotWeaponGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/BotWeaponGenerator.d.ts @@ -43,7 +43,7 @@ export declare class BotWeaponGenerator { * @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; + generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult; /** * Get a random weighted weapon from a bots pool of weapons * @param equipmentSlot Primary/secondary/holster @@ -62,7 +62,7 @@ export declare class BotWeaponGenerator { * @param isPmc * @returns GenerateWeaponResult object */ - generateWeaponByTpl(sessionId: string, 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, botLevel: number): GenerateWeaponResult; /** * Create array with weapon base as only element and * add additional properties based on weapon type diff --git a/TypeScript/1LogToConsole/types/generators/LocationGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/LocationGenerator.d.ts index cc61dcf..aafe758 100644 --- a/TypeScript/1LogToConsole/types/generators/LocationGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/LocationGenerator.d.ts @@ -9,6 +9,7 @@ import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticL import { ILocationConfig } from "../models/spt/config/ILocationConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; @@ -29,9 +30,10 @@ export declare class LocationGenerator { protected gameEventHelper: GameEventHelper; protected containerHelper: ContainerHelper; protected presetHelper: PresetHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, gameEventHelper: GameEventHelper, containerHelper: ContainerHelper, presetHelper: PresetHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, gameEventHelper: GameEventHelper, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; diff --git a/TypeScript/1LogToConsole/types/generators/LootGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/LootGenerator.d.ts index bc0d7ec..0d2ef24 100644 --- a/TypeScript/1LogToConsole/types/generators/LootGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/LootGenerator.d.ts @@ -6,6 +6,7 @@ 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 { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; export declare class LootGenerator { @@ -14,8 +15,9 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected localisationService: LocalisationService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated diff --git a/TypeScript/1LogToConsole/types/generators/PlayerScavGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/PlayerScavGenerator.d.ts index bb2c730..9fee88b 100644 --- a/TypeScript/1LogToConsole/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/PlayerScavGenerator.d.ts @@ -10,6 +10,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "../utils/JsonUtil"; import { BotGenerator } from "./BotGenerator"; export declare class PlayerScavGenerator { @@ -21,10 +22,11 @@ export declare class PlayerScavGenerator { protected jsonUtil: JsonUtil; protected fenceService: FenceService; protected botLootCacheService: BotLootCacheService; + protected localisationService: LocalisationService; protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); /** * Update a player profile to include a new player scav profile * @param sessionID session id to specify what profile is updated diff --git a/TypeScript/1LogToConsole/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/RagfairOfferGenerator.d.ts index 23882d2..dba8eb3 100644 --- a/TypeScript/1LogToConsole/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/RagfairOfferGenerator.d.ts @@ -7,7 +7,7 @@ import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "../models/eft/ragfair/IRagfairOffer"; -import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; +import { Dynamic, IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -88,7 +88,16 @@ export declare class RagfairOfferGenerator { * Create multiple offers for items by using a unique list of items we've generated previously * @param expiredOffers optional, expired offers to regenerate */ - generateDynamicOffers(expiredOffers?: Item[]): void; + generateDynamicOffers(expiredOffers?: Item[]): Promise; + protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + /** + * Create one flea offer for a specific item + * @param items Item to create offer for + * @param isPreset Is item a weapon preset + * @param itemDetails raw db item details + * @returns + */ + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for diff --git a/TypeScript/1LogToConsole/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/BotGeneratorHelper.d.ts index 899669e..cdb530c 100644 --- a/TypeScript/1LogToConsole/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/BotGeneratorHelper.d.ts @@ -12,6 +12,7 @@ import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotHelper } from "./BotHelper"; import { BotWeaponGeneratorHelper } from "./BotWeaponGeneratorHelper"; import { ContainerHelper } from "./ContainerHelper"; import { InventoryHelper } from "./InventoryHelper"; @@ -44,10 +45,11 @@ export declare class BotGeneratorHelper { protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botHelper: BotHelper; protected localisationService: LocalisationService; 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, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, configServer: ConfigServer); + 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, botHelper: BotHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to @@ -61,6 +63,7 @@ export declare class BotGeneratorHelper { */ generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; /** + * Add mods to a weapon using the provided mod pool * @param sessionId session id * @param weapon Weapon to add mods to * @param modPool Pool of compatible mods to attach to weapon @@ -71,7 +74,7 @@ export declare class BotGeneratorHelper { * @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[]; + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string, botLevel: number): Item[]; /** * * @param modSlot Slot mod will fit into @@ -209,6 +212,18 @@ export declare class BotGeneratorHelper { generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; + /** + * Get the chance for the light or laser to be set as active on weapon, default to 50% if no bot/equip settings found + * @param botRole role of bot with weapon + * @returns Percent chance to be active + */ + protected getLightLaserActiveChance(botRole: string): number; + /** + * Get the chance for the faceshield to be set as enabled, default to 75% if no bot/equip settings found + * @param botRole role of bot with faceshield + * @returns Percent chance to be active + */ + protected getFaceShieldActiveChance(botRole: string): number; /** * Create a repairable object for a weapon that containers durability + max durability properties * @param itemTemplate weapon object being generated for diff --git a/TypeScript/1LogToConsole/types/helpers/BotHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/BotHelper.d.ts index a7f779e..9a43b8e 100644 --- a/TypeScript/1LogToConsole/types/helpers/BotHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/BotHelper.d.ts @@ -1,5 +1,6 @@ +import { MinMax } from "../models/common/MinMax"; import { Difficulty, IBotType } from "../models/eft/common/tables/IBotType"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -59,4 +60,29 @@ export declare class BotHelper { * @returns true if should be a pmc */ shouldBotBePmc(botRole: string): boolean; + rollChanceToBePmc(role: string, botConvertMinMax: MinMax): boolean; + botRoleIsPmc(botRole: string): boolean; + /** + * Get randomisation settings for bot from config/bot.json + * @param botLevel level of bot + * @param botEquipConfig bot equipment json + * @returns RandomisationDetails + */ + getBotRandomisationDetails(botLevel: number, botEquipConfig: EquipmentFilters): RandomisationDetails; + /** + * Choose between sptBear and sptUsec at random based on the % defined in botConfig.pmc.isUsec + * @returns pmc role + */ + getRandomisedPmcRole(): string; + /** + * Get the corrisponding side when sptBear or sptUsec is passed in + * @param botRole role to get side for + * @returns side (usec/bear) + */ + getPmcSideByRole(botRole: string): string; + /** + * Get a randomised PMC side based on bot config value 'isUsec' + * @returns pmc side as string + */ + protected getRandomisedPmcSide(): string; } diff --git a/TypeScript/1LogToConsole/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/BotWeaponGeneratorHelper.d.ts index 7e25f56..b087fa9 100644 --- a/TypeScript/1LogToConsole/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -4,6 +4,7 @@ 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 { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ContainerHelper } from "./ContainerHelper"; @@ -16,8 +17,9 @@ export declare class BotWeaponGeneratorHelper { protected randomUtil: RandomUtil; protected hashUtil: HashUtil; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); /** * Get a randomised number of bullets for a specific magazine * @param magCounts min and max count of magazines diff --git a/TypeScript/1LogToConsole/types/helpers/DialogueHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/DialogueHelper.d.ts index 88a726e..8f03b81 100644 --- a/TypeScript/1LogToConsole/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/DialogueHelper.d.ts @@ -4,6 +4,7 @@ import { MessageType } from "../models/enums/MessageType"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { ItemHelper } from "./ItemHelper"; import { NotificationSendHelper } from "./NotificationSendHelper"; @@ -15,8 +16,9 @@ export declare class DialogueHelper { protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; protected notificationSendHelper: NotificationSendHelper; + protected localisationService: LocalisationService; protected itemHelper: ItemHelper; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent; /** * Add a templated message to the dialogue. diff --git a/TypeScript/1LogToConsole/types/helpers/HandbookHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/HandbookHelper.d.ts index 1ab7800..05f8217 100644 --- a/TypeScript/1LogToConsole/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/HandbookHelper.d.ts @@ -11,6 +11,7 @@ export declare class LookupCollection { } export declare class HandbookHelper { protected databaseServer: DatabaseServer; + protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; constructor(databaseServer: DatabaseServer); hydrateLookup(): void; diff --git a/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts index fc88a46..28aab66 100644 --- a/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts @@ -5,12 +5,15 @@ 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 { ItemBaseClassService } from "../services/ItemBaseClassService"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; 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"; +import { HandbookHelper } from "./HandbookHelper"; declare class ItemHelper { protected logger: ILogger; protected hashUtil: HashUtil; @@ -19,8 +22,11 @@ declare class ItemHelper { protected objectId: ObjectId; protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; + protected handbookHelper: HandbookHelper; + protected itemBaseClassService: ItemBaseClassService; + protected localisationService: LocalisationService; protected localeService: LocaleService; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * 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 diff --git a/TypeScript/1LogToConsole/types/helpers/QuestHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/QuestHelper.d.ts index edbd2e1..363a9e1 100644 --- a/TypeScript/1LogToConsole/types/helpers/QuestHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/QuestHelper.d.ts @@ -10,6 +10,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -32,10 +33,11 @@ export declare class QuestHelper { protected dialogueHelper: DialogueHelper; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected traderHelper: TraderHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, configServer: ConfigServer); /** * Get status of a quest by quest id * @param pmcData Profile to search diff --git a/TypeScript/1LogToConsole/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/RagfairOfferHelper.d.ts index b73f786..95be986 100644 --- a/TypeScript/1LogToConsole/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/RagfairOfferHelper.d.ts @@ -46,7 +46,7 @@ export declare class RagfairOfferHelper { protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, 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[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; /** * Check if trader offers' BuyRestrictionMax value has been reached @@ -64,5 +64,5 @@ export declare class RagfairOfferHelper { protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; - isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; } diff --git a/TypeScript/1LogToConsole/types/helpers/TraderAssortHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/TraderAssortHelper.d.ts index 025efd6..3861abd 100644 --- a/TypeScript/1LogToConsole/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/TraderAssortHelper.d.ts @@ -7,6 +7,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; @@ -27,11 +28,12 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected localisationService: LocalisationService; protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - 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); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, localisationService: LocalisationService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts diff --git a/TypeScript/1LogToConsole/types/loaders/PostDBModLoader.d.ts b/TypeScript/1LogToConsole/types/loaders/PostDBModLoader.d.ts index 5101b7b..87b60f9 100644 --- a/TypeScript/1LogToConsole/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/1LogToConsole/types/loaders/PostDBModLoader.d.ts @@ -4,7 +4,7 @@ import { PreAkiModLoader } from "./PreAkiModLoader"; export declare class PostDBModLoader implements OnLoad { protected preAkiModLoader: PreAkiModLoader; constructor(preAkiModLoader: PreAkiModLoader); - onLoad(): void; + onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; protected executeMods(container: DependencyContainer): void; diff --git a/TypeScript/1LogToConsole/types/models/eft/bot/IRandomisedBotLevelResult.d.ts b/TypeScript/1LogToConsole/types/models/eft/bot/IRandomisedBotLevelResult.d.ts new file mode 100644 index 0000000..75bd936 --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/eft/bot/IRandomisedBotLevelResult.d.ts @@ -0,0 +1,4 @@ +export interface IRandomisedBotLevelResult { + level: number; + exp: number; +} diff --git a/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotBase.d.ts index 2b418c1..1c28ae0 100644 --- a/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotBase.d.ts @@ -107,7 +107,6 @@ export interface CurrentMax { Maximum: number; } export interface Inventory { - discardLimits: Record; items: Item[]; equipment: string; stash: string; diff --git a/TypeScript/1LogToConsole/types/models/eft/common/tables/IQuest.d.ts b/TypeScript/1LogToConsole/types/models/eft/common/tables/IQuest.d.ts index c5b1cb2..d538126 100644 --- a/TypeScript/1LogToConsole/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/common/tables/IQuest.d.ts @@ -37,7 +37,7 @@ export interface Conditions { export interface AvailableForConditions { _parent: string; _props: AvailableForProps; - dynamicLocale: boolean; + dynamicLocale?: boolean; } export interface AvailableForProps { id: string; diff --git a/TypeScript/1LogToConsole/types/models/eft/customization/IGetSuitsResponse.d.ts b/TypeScript/1LogToConsole/types/models/eft/customization/IGetSuitsResponse.d.ts index fe6888c..cbb909d 100644 --- a/TypeScript/1LogToConsole/types/models/eft/customization/IGetSuitsResponse.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/customization/IGetSuitsResponse.d.ts @@ -1,4 +1,4 @@ export interface IGetSuitsResponse { _id: string; - suits: string[]; + suites: string[]; } diff --git a/TypeScript/1LogToConsole/types/models/enums/ExitStatis.d.ts b/TypeScript/1LogToConsole/types/models/enums/ExitStatis.d.ts new file mode 100644 index 0000000..78d9733 --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/enums/ExitStatis.d.ts @@ -0,0 +1,7 @@ +export declare enum ExitStatus { + SURVIVED = 0, + KILLED = 1, + LEFT = 2, + RUNNER = 3, + MISSINGINACTION = 4 +} diff --git a/TypeScript/1LogToConsole/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/1LogToConsole/types/models/spt/bots/BotGenerationDetails.d.ts new file mode 100644 index 0000000..26571a2 --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/spt/bots/BotGenerationDetails.d.ts @@ -0,0 +1,18 @@ +export interface BotGenerationDetails { + /** Should the bot be generated as a PMC */ + isPmc: boolean; + /** assault/pmcBot etc */ + role: string; + /** Side of bot */ + side: string; + /** Active players current level */ + playerLevel: number; + /** Delta of highest level of bot */ + botRelativeLevelDeltaMax: number; + /** How many to create and store */ + botCountToGenerate: number; + /** Desired difficulty of the bot */ + botDifficulty: string; + /** Will the generated bot be a player scav */ + isPlayerScav: boolean; +} diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IBotConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IBotConfig.d.ts index d6fa5e0..83897db 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IBotConfig.d.ts @@ -66,10 +66,9 @@ export interface LootNvalue { } export interface EquipmentFilters { weaponModLimits: ModLimits; - randomisedWeaponModSlots?: string[]; - randomisedArmorSlots?: string[]; faceShieldIsActiveChancePercent?: number; lightLaserIsActiveChancePercent?: number; + randomisation: RandomisationDetails[]; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; clothing: WeightingAdjustmentDetails[]; @@ -81,6 +80,15 @@ export interface ModLimits { /** How many lasers or lights are allowed on a weapon - hard coded to work with TACTICAL_COMBO, and FLASHLIGHT */ lightLaserLimit?: number; } +export interface RandomisationDetails { + levelRange: MinMax; + randomisedWeaponModSlots?: string[]; + randomisedArmorSlots?: string[]; + /** Equipment chances */ + equipment?: Record; + /** Modc chances */ + mods?: Record; +} export interface EquipmentFilterDetails { levelRange: MinMax; equipment: Record; @@ -88,6 +96,11 @@ export interface EquipmentFilterDetails { } export interface WeightingAdjustmentDetails { levelRange: MinMax; + ammo?: AdjustmentDetails; + equipment?: AdjustmentDetails; + clothing?: AdjustmentDetails; +} +export interface AdjustmentDetails { add: Record>; edit: Record>; } diff --git a/TypeScript/1LogToConsole/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/ILocationConfig.d.ts index 0551d57..a012fae 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/ILocationConfig.d.ts @@ -1,8 +1,16 @@ +import { BossLocationSpawn, Wave } from "../../../models/eft/common/ILocationBase"; import { IBaseConfig } from "./IBaseConfig"; export interface ILocationConfig extends IBaseConfig { kind: "aki-location"; looseLootMultiplier: LootMultiplier; staticLootMultiplier: LootMultiplier; + customWaves: CustomWaves; + /** Open zones to add to map */ + openZones: Record; +} +export interface CustomWaves { + boss: Record; + normal: Record; } export interface LootMultiplier { bigmap: number; diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IPmcConfig.d.ts index 48601b2..979122c 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IPmcConfig.d.ts @@ -16,6 +16,7 @@ export interface IPmcConfig { maxVestLootTotalRub: number; convertIntoPmcChance: Record; enemyTypes: string[]; + botRelativeLevelDeltaMax: number; } export interface PmcTypes { usec: string; diff --git a/TypeScript/1LogToConsole/types/routers/ItemEventRouter.d.ts b/TypeScript/1LogToConsole/types/routers/ItemEventRouter.d.ts index e80d16c..a9338ab 100644 --- a/TypeScript/1LogToConsole/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/1LogToConsole/types/routers/ItemEventRouter.d.ts @@ -1,14 +1,16 @@ -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; -import { ProfileHelper } from "../helpers/ProfileHelper"; import { ItemEventRouterDefinition } from "../di/Router"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { EventOutputHolder } from "./EventOutputHolder"; export declare class ItemEventRouter { protected logger: ILogger; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; + protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); handleEvents(info: IItemEventRouterRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/1LogToConsole/types/servers/RagfairServer.d.ts b/TypeScript/1LogToConsole/types/servers/RagfairServer.d.ts index c93864b..f49654a 100644 --- a/TypeScript/1LogToConsole/types/servers/RagfairServer.d.ts +++ b/TypeScript/1LogToConsole/types/servers/RagfairServer.d.ts @@ -4,6 +4,7 @@ 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"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairCategoriesService } from "../services/RagfairCategoriesService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairRequiredItemsService } from "../services/RagfairRequiredItemsService"; @@ -14,13 +15,14 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected localisationService: LocalisationService; protected traderHelper: TraderHelper; protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); - load(): void; - update(): void; + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, localisationService: LocalisationService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); + load(): Promise; + update(): Promise; /** * Get traders who need to be periodically refreshed * @returns string array of traders diff --git a/TypeScript/1LogToConsole/types/services/BotEquipmentFilterService.d.ts b/TypeScript/1LogToConsole/types/services/BotEquipmentFilterService.d.ts index ae72cc3..43e64b0 100644 --- a/TypeScript/1LogToConsole/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/1LogToConsole/types/services/BotEquipmentFilterService.d.ts @@ -1,21 +1,29 @@ -import { IBotType } from "../models/eft/common/tables/IBotType"; -import { EquipmentFilters, EquipmentFilterDetails, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; +import { BotHelper } from "../helpers/BotHelper"; +import { EquipmentChances, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; +import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } 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 botHelper: BotHelper; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected botEquipmentConfig: Record; - constructor(logger: ILogger, configServer: ConfigServer); + constructor(logger: ILogger, botHelper: BotHelper, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig * @param baseBotNode bots json data to filter - * @param playerLevel Level of the currently playing player - * @param isPmc Is the bot we're filtering a PMC - * @param role Role of the bot we're filtering + * @param botLevel Level of the bot + * @param botGenerationDetails details on how to generate a bot */ - filterBotEquipment(baseBotNode: IBotType, playerLevel: number, isPmc: boolean, role: string): void; + filterBotEquipment(baseBotNode: IBotType, botLevel: number, botGenerationDetails: BotGenerationDetails): void; + /** + * Iterate over the changes passed in and alter data in baseValues + * @param equipmentChanges Changes to apply + * @param baseValues Values to update + */ + protected adjustChances(equipmentChanges: Record, baseValues: EquipmentChances | ModsChances): void; /** * Get an object that contains equipment and cartridge blacklists for a specified bot type * @param botRole Role of the bot we want the blacklist for @@ -66,5 +74,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: WeightingAdjustmentDetails, botItemPool: Record): void; + protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/1LogToConsole/types/services/BotGenerationCacheService.d.ts b/TypeScript/1LogToConsole/types/services/BotGenerationCacheService.d.ts index 0be0576..a491b03 100644 --- a/TypeScript/1LogToConsole/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/1LogToConsole/types/services/BotGenerationCacheService.d.ts @@ -3,32 +3,34 @@ 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"; +import { LocalisationService } from "./LocalisationService"; export declare class BotGenerationCacheService { protected logger: ILogger; protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; + protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; - constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage * @param botsToStore Bots we want to store in the cache */ - storeBots(botsToStore: IBotBase[]): void; + storeBots(key: string, 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) + * @param key role to retreive (assault/bossTagilla etc) * @returns IBotBase object */ - getBot(role: string): IBotBase; + getBot(key: string): IBotBase; /** * Remove all cached bot profiles */ clearStoredBots(): void; /** - * Does cache have bots - * @returns true if empty + * Does cache have a bot with requested key + * @returns false if empty */ - cacheHasBotOfRole(role: string): boolean; + cacheHasBotOfRole(key: string): boolean; } diff --git a/TypeScript/1LogToConsole/types/services/BotLootCacheService.d.ts b/TypeScript/1LogToConsole/types/services/BotLootCacheService.d.ts index 00ffb9c..dab7c6d 100644 --- a/TypeScript/1LogToConsole/types/services/BotLootCacheService.d.ts +++ b/TypeScript/1LogToConsole/types/services/BotLootCacheService.d.ts @@ -5,15 +5,17 @@ import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; +import { LocalisationService } from "./LocalisationService"; import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; + protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, ragfairPriceService: RagfairPriceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ diff --git a/TypeScript/1LogToConsole/types/services/CustomLocationWaveService.d.ts b/TypeScript/1LogToConsole/types/services/CustomLocationWaveService.d.ts new file mode 100644 index 0000000..7d14f07 --- /dev/null +++ b/TypeScript/1LogToConsole/types/services/CustomLocationWaveService.d.ts @@ -0,0 +1,42 @@ +import { BossLocationSpawn, Wave } from "../models/eft/common/ILocationBase"; +import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class CustomLocationWaveService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected locationConfig: ILocationConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Add a boss wave to a map + * @param locationId e.g. factory4_day, bigmap + * @param waveToAdd Boss wave to add to map + */ + addBossWaveToMap(locationId: string, waveToAdd: BossLocationSpawn): void; + /** + * Add a normal bot wave to a map + * @param locationId e.g. factory4_day, bigmap + * @param waveToAdd Wave to add to map + */ + addNormalWaveToMap(locationId: string, waveToAdd: Wave): void; + /** + * Clear all custom boss waves from a map + * @param locationId e.g. factory4_day, bigmap + */ + clearBossWavesForMap(locationId: string): void; + /** + * Clear all custom normal waves from a map + * @param locationId e.g. factory4_day, bigmap + */ + clearNormalWavesForMap(locationId: string): void; + /** + * Add custom boss and normal waves to maps found in config/location.json to db + */ + applyWaveChangesToAllMaps(): void; +} diff --git a/TypeScript/1LogToConsole/types/services/FenceService.d.ts b/TypeScript/1LogToConsole/types/services/FenceService.d.ts index bdcdeb2..f8919f1 100644 --- a/TypeScript/1LogToConsole/types/services/FenceService.d.ts +++ b/TypeScript/1LogToConsole/types/services/FenceService.d.ts @@ -15,6 +15,7 @@ import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { ItemFilterService } from "./ItemFilterService"; +import { LocalisationService } from "./LocalisationService"; /** * Handle actions surrounding Fence * e.g. generating or refreshing assorts / get next refresh time @@ -30,11 +31,12 @@ export declare class FenceService { protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; 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); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, localisationService: LocalisationService, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; /** * Get assorts player can purchase diff --git a/TypeScript/1LogToConsole/types/services/InsuranceService.d.ts b/TypeScript/1LogToConsole/types/services/InsuranceService.d.ts index 6be8a2f..1154160 100644 --- a/TypeScript/1LogToConsole/types/services/InsuranceService.d.ts +++ b/TypeScript/1LogToConsole/types/services/InsuranceService.d.ts @@ -1,4 +1,5 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; +import { HandbookHelper } from "../helpers/HandbookHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; @@ -21,10 +22,11 @@ export declare class InsuranceService { protected saveServer: SaveServer; protected traderHelper: TraderHelper; protected dialogueHelper: DialogueHelper; + protected handbookHelper: HandbookHelper; protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, configServer: ConfigServer); insuranceExists(sessionId: string): boolean; insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; getInsurance(sessionId: string): Record; diff --git a/TypeScript/1LogToConsole/types/services/ItemBaseClassService.d.ts b/TypeScript/1LogToConsole/types/services/ItemBaseClassService.d.ts new file mode 100644 index 0000000..7d816c4 --- /dev/null +++ b/TypeScript/1LogToConsole/types/services/ItemBaseClassService.d.ts @@ -0,0 +1,37 @@ +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +/** + * Cache the baseids for each item in the tiems db inside a dictionary + */ +export declare class ItemBaseClassService { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected itemBaseClassesCache: Record; + protected cacheGenerated: boolean; + constructor(logger: ILogger, databaseServer: DatabaseServer); + /** + * Create cache and store inside ItemBaseClassService + */ + hydrateItemBaseClassCache(): void; + /** + * Helper method, recursivly iterate through items parent items, finding and adding ids to dictionary + * @param itemIdToUpdate item tpl to store base ids against in dictionary + * @param item item being checked + * @param allDbItems all items in db + */ + protected addBaseItems(itemIdToUpdate: string, item: ITemplateItem, allDbItems: Record): void; + /** + * Does item tpl inherit from the requested base class + * @param itemTpl item to check base classes of + * @param baseClass base class to check for + * @returns true if item inherits from base class passed in + */ + itemHasBaseClass(itemTpl: string, baseClass: string): boolean; + /** + * Get base classes item inherits from + * @param itemTpl item to get base classes for + * @returns array of base classes + */ + getItemBaseClasses(itemTpl: string): string[]; +} diff --git a/TypeScript/1LogToConsole/types/services/OpenZoneService.d.ts b/TypeScript/1LogToConsole/types/services/OpenZoneService.d.ts new file mode 100644 index 0000000..8e70b94 --- /dev/null +++ b/TypeScript/1LogToConsole/types/services/OpenZoneService.d.ts @@ -0,0 +1,28 @@ +import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { LocalisationService } from "./LocalisationService"; +/** Service for adding new zones to a maps OpenZones property */ +export declare class OpenZoneService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; + protected configServer: ConfigServer; + protected locationConfig: ILocationConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add open zone to specified map + * @param locationId map location (e.g. factory4_day) + * @param zoneToAdd zone to add + */ + addZoneToMap(locationId: string, zoneToAdd: string): void; + /** + * Add open zones to all maps found in config/location.json to db + */ + applyZoneChangesToAllMaps(): void; +} diff --git a/TypeScript/1LogToConsole/types/services/RagfairOfferService.d.ts b/TypeScript/1LogToConsole/types/services/RagfairOfferService.d.ts index 86c1e52..133e6a7 100644 --- a/TypeScript/1LogToConsole/types/services/RagfairOfferService.d.ts +++ b/TypeScript/1LogToConsole/types/services/RagfairOfferService.d.ts @@ -1,3 +1,4 @@ +import { RagfairOfferHolder } from "../utils/RagfairOfferHolder"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; import { Item } from "../models/eft/common/tables/IItem"; @@ -26,10 +27,9 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected expiredOffers: Item[]; - /** offerId, offer */ - protected offers: Record; + protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; + protected ragfairOfferHandler: RagfairOfferHolder; constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all offers @@ -45,7 +45,7 @@ export declare class RagfairOfferService { * Get an array of expired items not yet processed into new offers * @returns items that need to be turned into offers */ - getExpiredOffers(): Item[]; + getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -64,12 +64,6 @@ export declare class RagfairOfferService { traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; - /** - * Get an array of stale offers that are still shown to player - * @returns IRagfairOffer array - */ - protected getStaleOffers(): IRagfairOffer[]; - protected isStale(offer: IRagfairOffer, time: number): boolean; protected processStaleOffer(staleOffer: IRagfairOffer): void; protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; } diff --git a/TypeScript/1LogToConsole/types/services/RagfairPriceService.d.ts b/TypeScript/1LogToConsole/types/services/RagfairPriceService.d.ts index 4ac7794..3bd94b5 100644 --- a/TypeScript/1LogToConsole/types/services/RagfairPriceService.d.ts +++ b/TypeScript/1LogToConsole/types/services/RagfairPriceService.d.ts @@ -24,7 +24,7 @@ export declare class RagfairPriceService implements OnLoad { protected generatedStaticPrices: boolean; protected prices: IRagfairServerPrices; constructor(handbookHelper: HandbookHelper, databaseServer: DatabaseServer, logger: ILogger, itemHelper: ItemHelper, presetHelper: PresetHelper, randomUtil: RandomUtil, configServer: ConfigServer); - onLoad(): void; + onLoad(): Promise; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache diff --git a/TypeScript/1LogToConsole/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/1LogToConsole/types/services/RagfairRequiredItemsService.d.ts index b05fc65..95c3ddb 100644 --- a/TypeScript/1LogToConsole/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/1LogToConsole/types/services/RagfairRequiredItemsService.d.ts @@ -7,6 +7,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItems(searchId: string): any; + getRequiredItemsById(searchId: string): any; buildRequiredItemTable(): void; } diff --git a/TypeScript/1LogToConsole/types/services/mod/onLoad/OnLoadMod.d.ts b/TypeScript/1LogToConsole/types/services/mod/onLoad/OnLoadMod.d.ts index 53fb062..82909c3 100644 --- a/TypeScript/1LogToConsole/types/services/mod/onLoad/OnLoadMod.d.ts +++ b/TypeScript/1LogToConsole/types/services/mod/onLoad/OnLoadMod.d.ts @@ -3,6 +3,6 @@ export declare class OnLoadMod extends OnLoad { private onLoadOverride; private getRouteOverride; constructor(onLoadOverride: () => void, getRouteOverride: () => string); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/1LogToConsole/types/services/mod/onUpdate/OnUpdateMod.d.ts b/TypeScript/1LogToConsole/types/services/mod/onUpdate/OnUpdateMod.d.ts index ee89043..edd2a2c 100644 --- a/TypeScript/1LogToConsole/types/services/mod/onUpdate/OnUpdateMod.d.ts +++ b/TypeScript/1LogToConsole/types/services/mod/onUpdate/OnUpdateMod.d.ts @@ -3,6 +3,6 @@ export declare class OnUpdateMod extends OnUpdate { private onUpdateOverride; private getRouteOverride; constructor(onUpdateOverride: (timeSinceLastRun: number) => boolean, getRouteOverride: () => string); - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/1LogToConsole/types/utils/App.d.ts b/TypeScript/1LogToConsole/types/utils/App.d.ts index cc8a5af..b947c83 100644 --- a/TypeScript/1LogToConsole/types/utils/App.d.ts +++ b/TypeScript/1LogToConsole/types/utils/App.d.ts @@ -11,7 +11,7 @@ export declare class App { protected onUpdateComponents: OnUpdate[]; protected onUpdateLastRun: {}; constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); - load(): void; - protected update(onUpdateComponents: OnUpdate[]): void; + load(): Promise; + protected update(onUpdateComponents: OnUpdate[]): Promise; protected logUpdateException(err: any, updateable: OnUpdate): void; } diff --git a/TypeScript/1LogToConsole/types/utils/DatabaseImporter.d.ts b/TypeScript/1LogToConsole/types/utils/DatabaseImporter.d.ts index 31670ae..ed400da 100644 --- a/TypeScript/1LogToConsole/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/1LogToConsole/types/utils/DatabaseImporter.d.ts @@ -14,13 +14,13 @@ export declare class DatabaseImporter extends OnLoad { protected databaseServer: DatabaseServer; protected imageRouter: ImageRouter; constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter); - onLoad(): void; + onLoad(): Promise; /** * Read all json files in database folder and map into a json object * @param filepath path to database folder */ - protected hydrateDatabase(filepath: string): void; + protected hydrateDatabase(filepath: string): Promise; getRoute(): string; - loadRecursive(filepath: string): IDatabaseTables; + loadRecursive(filepath: string): Promise; loadImages(filepath: string): void; } diff --git a/TypeScript/1LogToConsole/types/utils/JsonUtil.d.ts b/TypeScript/1LogToConsole/types/utils/JsonUtil.d.ts index 71e95f6..2591142 100644 --- a/TypeScript/1LogToConsole/types/utils/JsonUtil.d.ts +++ b/TypeScript/1LogToConsole/types/utils/JsonUtil.d.ts @@ -6,6 +6,7 @@ export declare class JsonUtil { protected hashUtil: HashUtil; protected logger: ILogger; protected fileHashes: any; + protected jsonCacheExists: boolean; constructor(vfs: VFS, hashUtil: HashUtil, logger: ILogger); /** * From object to string diff --git a/TypeScript/1LogToConsole/types/utils/Logger.d.ts b/TypeScript/1LogToConsole/types/utils/Logger.d.ts index 3d9013f..1088701 100644 --- a/TypeScript/1LogToConsole/types/utils/Logger.d.ts +++ b/TypeScript/1LogToConsole/types/utils/Logger.d.ts @@ -53,6 +53,12 @@ export declare class WinstonLogger implements ILogger { warning(data: string | Record): Promise; success(data: string | Record): Promise; info(data: string | Record): Promise; + /** + * Log to console text with a customisable text and background color. Background defaults to black + * @param data text to log + * @param textColor color of text + * @param backgroundColor color of background + */ logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): Promise; debug(data: string | Record, onlyShowInConsole?: boolean): Promise; } diff --git a/TypeScript/1LogToConsole/types/utils/RagfairOfferHolder.d.ts b/TypeScript/1LogToConsole/types/utils/RagfairOfferHolder.d.ts new file mode 100644 index 0000000..46d9e23 --- /dev/null +++ b/TypeScript/1LogToConsole/types/utils/RagfairOfferHolder.d.ts @@ -0,0 +1,24 @@ +import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +export declare class RagfairOfferHolder { + private offersById; + private offersByTemplate; + private offersByTrader; + constructor(); + getOfferById(id: string): IRagfairOffer; + getOffersByTemplate(templateId: string): Array; + getOffersByTrader(traderId: string): Array; + getOffers(): Array; + addOffers(offers: Array): void; + addOffer(offer: IRagfairOffer): void; + removeOffer(offer: IRagfairOffer): void; + removeOffers(offers: Array): void; + removeOfferByTrader(traderId: string): void; + /** + * Get an array of stale offers that are still shown to player + * @returns IRagfairOffer array + */ + getStaleOffers(time: number): Array; + private addOfferByTemplates; + private addOfferByTrader; + protected isStale(offer: IRagfairOffer, time: number): boolean; +} diff --git a/TypeScript/1LogToConsole/types/utils/Watermark.d.ts b/TypeScript/1LogToConsole/types/utils/Watermark.d.ts index e02eba2..f870cf1 100644 --- a/TypeScript/1LogToConsole/types/utils/Watermark.d.ts +++ b/TypeScript/1LogToConsole/types/utils/Watermark.d.ts @@ -30,7 +30,11 @@ export declare class Watermark { * @returns string */ getVersionTag(withEftVersion?: boolean): string; - getVersionLabel(): string; + /** + * Get text shown in game on screen, can't be translated as it breaks bsgs client when certian characters are used + * @returns string + */ + getInGameVersionLabel(): string; /** Set window title */ setTitle(): void; /** Reset console cursor to top */ diff --git a/readme.md b/readme.md index a158c44..ce107d0 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -# Mod examples for 3.3.0 +# Mod examples for 3.4.0 A collection of example mods that perform typical actions in SPT