From 129b6eb52a1850ecfa5d2ef01246a62f8b04c82e Mon Sep 17 00:00:00 2001 From: Chomp Date: Tue, 23 Aug 2022 21:56:08 +0100 Subject: [PATCH] 3.2.2 --- TypeScript/10ScopesAndTypes/README.md | 4 +- TypeScript/10ScopesAndTypes/package.json | 2 +- TypeScript/11BundleLoadingSample/README.md | 4 +- TypeScript/11BundleLoadingSample/package.json | 2 +- TypeScript/12ClassExtensionOverride/README.md | 4 +- .../12ClassExtensionOverride/package.json | 2 +- TypeScript/13AddTrader/README.md | 4 +- TypeScript/13AddTrader/package.json | 2 +- TypeScript/14AfterDBLoadHook/README.md | 4 +- TypeScript/14AfterDBLoadHook/package.json | 2 +- TypeScript/1LogToConsole/README.md | 4 +- TypeScript/1LogToConsole/package.json | 2 +- .../types/callbacks/ProfileCallbacks.d.ts | 15 +++ .../types/callbacks/RagfairCallbacks.d.ts | 3 + .../controllers/InventoryController.d.ts | 6 +- .../types/controllers/RagfairController.d.ts | 12 +- .../RepeatableQuestController.d.ts | 17 ++- .../1LogToConsole/types/di/Container.d.ts | 3 + .../types/generators/BotGenerator.d.ts | 4 +- .../generators/BotInventoryGenerator.d.ts | 2 +- .../types/generators/BotLootGenerator.d.ts | 4 +- .../types/generators/BotWeaponGenerator.d.ts | 83 +++++++------- .../types/generators/PMCLootGenerator.d.ts | 12 +- .../generators/ScavCaseRewardGenerator.d.ts | 7 +- .../types/helpers/AssortHelper.d.ts | 4 +- .../types/helpers/BotGeneratorHelper.d.ts | 104 +++++++++++++++--- .../types/helpers/HideoutHelper.d.ts | 9 ++ .../types/helpers/ItemHelper.d.ts | 12 -- .../types/helpers/ProfileHelper.d.ts | 13 +++ .../types/helpers/RagfairOfferHelper.d.ts | 2 +- .../types/helpers/RagfairSellHelper.d.ts | 10 +- .../types/helpers/RagfairServerHelper.d.ts | 7 +- .../types/helpers/TradeHelper.d.ts | 6 + .../types/helpers/TraderAssortHelper.d.ts | 2 +- .../eft/common/tables/ITemplateItem.d.ts | 2 + .../models/eft/common/tables/ITrader.d.ts | 1 + .../models/eft/ragfair/IRagfairOffer.d.ts | 2 + .../types/models/enums/AmmoTypes.d.ts | 8 +- .../types/models/enums/BaseClasses.d.ts | 1 + .../types/models/enums/ConfigTypes.d.ts | 1 + .../types/models/spt/config/IBotConfig.d.ts | 7 ++ .../types/models/spt/config/IItemConfig.d.ts | 5 + .../types/models/spt/config/IQuestConfig.d.ts | 4 + .../models/spt/config/IRagfairConfig.d.ts | 1 + .../services/BotEquipmentFilterService.d.ts | 2 +- .../types/services/FenceService.d.ts | 8 +- .../types/services/ItemFilterService.d.ts | 24 ++++ .../types/services/ProfileFixerService.d.ts | 5 + .../1LogToConsole/types/utils/RandomUtil.d.ts | 6 + .../1LogToConsole/types/utils/TimeUtil.d.ts | 9 ++ TypeScript/2EditDatabase/README.md | 4 +- TypeScript/2EditDatabase/package.json | 2 +- TypeScript/3GetSptConfigFile/README.md | 4 +- TypeScript/3GetSptConfigFile/package.json | 2 +- TypeScript/4UseACustomConfigFile/README.md | 4 +- TypeScript/4UseACustomConfigFile/package.json | 2 +- TypeScript/5ReplaceMethod/README.md | 4 +- TypeScript/5ReplaceMethod/package.json | 2 +- TypeScript/6ReferenceAnotherClass/README.md | 4 +- .../6ReferenceAnotherClass/package.json | 2 +- TypeScript/7OnLoadHook/README.md | 4 +- TypeScript/7OnLoadHook/package.json | 2 +- TypeScript/8OnUpdateHook/README.md | 4 +- TypeScript/8OnUpdateHook/package.json | 2 +- TypeScript/9RouterHooks/README.md | 4 +- TypeScript/9RouterHooks/package.json | 2 +- 66 files changed, 374 insertions(+), 133 deletions(-) create mode 100644 TypeScript/1LogToConsole/types/models/spt/config/IItemConfig.d.ts create mode 100644 TypeScript/1LogToConsole/types/services/ItemFilterService.d.ts diff --git a/TypeScript/10ScopesAndTypes/README.md b/TypeScript/10ScopesAndTypes/README.md index efc31a4..b02734f 100644 --- a/TypeScript/10ScopesAndTypes/README.md +++ b/TypeScript/10ScopesAndTypes/README.md @@ -13,7 +13,7 @@ A system reboot may be needed after install. ## **IDE:** -The second step is having an IDE ready. For the currect purpose we've setup a VSCodium workspace file. +The second step is having an IDE ready. We've setup a VSCodium workspace file to help with this. You CAN use Visual Studio Code if you so desire, just keep in mind that our dev tests on the mod files was done using VSCodium. @@ -21,7 +21,7 @@ You can get VSCodium here: https://vscodium.com/#install ## **Workspace:** -Once you have NodeJS and VSCodium ready, open the mod.code-workspace file with VSCodium (File->Open Worspace from File...). +Once you have NodeJS and VSCodium ready, open the mod.code-workspace file with VSCodium (File->Open Workspace from File...). Once the project loads into VSCodium you will be recommended to install the ESLint plugin. This is HIGHLY recommended. diff --git a/TypeScript/10ScopesAndTypes/package.json b/TypeScript/10ScopesAndTypes/package.json index d7fb3f6..40e2bff 100644 --- a/TypeScript/10ScopesAndTypes/package.json +++ b/TypeScript/10ScopesAndTypes/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.2.1", + "akiVersion": "3.2.2", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" \"./**/*.*\" ./dist", diff --git a/TypeScript/11BundleLoadingSample/README.md b/TypeScript/11BundleLoadingSample/README.md index efc31a4..b02734f 100644 --- a/TypeScript/11BundleLoadingSample/README.md +++ b/TypeScript/11BundleLoadingSample/README.md @@ -13,7 +13,7 @@ A system reboot may be needed after install. ## **IDE:** -The second step is having an IDE ready. For the currect purpose we've setup a VSCodium workspace file. +The second step is having an IDE ready. We've setup a VSCodium workspace file to help with this. You CAN use Visual Studio Code if you so desire, just keep in mind that our dev tests on the mod files was done using VSCodium. @@ -21,7 +21,7 @@ You can get VSCodium here: https://vscodium.com/#install ## **Workspace:** -Once you have NodeJS and VSCodium ready, open the mod.code-workspace file with VSCodium (File->Open Worspace from File...). +Once you have NodeJS and VSCodium ready, open the mod.code-workspace file with VSCodium (File->Open Workspace from File...). Once the project loads into VSCodium you will be recommended to install the ESLint plugin. This is HIGHLY recommended. diff --git a/TypeScript/11BundleLoadingSample/package.json b/TypeScript/11BundleLoadingSample/package.json index bdad540..a28a985 100644 --- a/TypeScript/11BundleLoadingSample/package.json +++ b/TypeScript/11BundleLoadingSample/package.json @@ -4,7 +4,7 @@ "author": "Chomp", "license": "MIT", "main": "src/mod.js", - "akiVersion": "3.2.1", + "akiVersion": "3.2.2", "isBundleMod": true, "scripts": { "setup:environment": "npm i", diff --git a/TypeScript/12ClassExtensionOverride/README.md b/TypeScript/12ClassExtensionOverride/README.md index efc31a4..b02734f 100644 --- a/TypeScript/12ClassExtensionOverride/README.md +++ b/TypeScript/12ClassExtensionOverride/README.md @@ -13,7 +13,7 @@ A system reboot may be needed after install. ## **IDE:** -The second step is having an IDE ready. For the currect purpose we've setup a VSCodium workspace file. +The second step is having an IDE ready. We've setup a VSCodium workspace file to help with this. You CAN use Visual Studio Code if you so desire, just keep in mind that our dev tests on the mod files was done using VSCodium. @@ -21,7 +21,7 @@ You can get VSCodium here: https://vscodium.com/#install ## **Workspace:** -Once you have NodeJS and VSCodium ready, open the mod.code-workspace file with VSCodium (File->Open Worspace from File...). +Once you have NodeJS and VSCodium ready, open the mod.code-workspace file with VSCodium (File->Open Workspace from File...). Once the project loads into VSCodium you will be recommended to install the ESLint plugin. This is HIGHLY recommended. diff --git a/TypeScript/12ClassExtensionOverride/package.json b/TypeScript/12ClassExtensionOverride/package.json index b72c696..b33ef99 100644 --- a/TypeScript/12ClassExtensionOverride/package.json +++ b/TypeScript/12ClassExtensionOverride/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.2.1", + "akiVersion": "3.2.2", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" \"./**/*.*\" ./dist", diff --git a/TypeScript/13AddTrader/README.md b/TypeScript/13AddTrader/README.md index efc31a4..b02734f 100644 --- a/TypeScript/13AddTrader/README.md +++ b/TypeScript/13AddTrader/README.md @@ -13,7 +13,7 @@ A system reboot may be needed after install. ## **IDE:** -The second step is having an IDE ready. For the currect purpose we've setup a VSCodium workspace file. +The second step is having an IDE ready. We've setup a VSCodium workspace file to help with this. You CAN use Visual Studio Code if you so desire, just keep in mind that our dev tests on the mod files was done using VSCodium. @@ -21,7 +21,7 @@ You can get VSCodium here: https://vscodium.com/#install ## **Workspace:** -Once you have NodeJS and VSCodium ready, open the mod.code-workspace file with VSCodium (File->Open Worspace from File...). +Once you have NodeJS and VSCodium ready, open the mod.code-workspace file with VSCodium (File->Open Workspace from File...). Once the project loads into VSCodium you will be recommended to install the ESLint plugin. This is HIGHLY recommended. diff --git a/TypeScript/13AddTrader/package.json b/TypeScript/13AddTrader/package.json index 70cb9df..f0d3c57 100644 --- a/TypeScript/13AddTrader/package.json +++ b/TypeScript/13AddTrader/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Shirito", - "akiVersion": "3.2.1", + "akiVersion": "3.2.2", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" ./**/*.* ./dist", diff --git a/TypeScript/14AfterDBLoadHook/README.md b/TypeScript/14AfterDBLoadHook/README.md index efc31a4..b02734f 100644 --- a/TypeScript/14AfterDBLoadHook/README.md +++ b/TypeScript/14AfterDBLoadHook/README.md @@ -13,7 +13,7 @@ A system reboot may be needed after install. ## **IDE:** -The second step is having an IDE ready. For the currect purpose we've setup a VSCodium workspace file. +The second step is having an IDE ready. We've setup a VSCodium workspace file to help with this. You CAN use Visual Studio Code if you so desire, just keep in mind that our dev tests on the mod files was done using VSCodium. @@ -21,7 +21,7 @@ You can get VSCodium here: https://vscodium.com/#install ## **Workspace:** -Once you have NodeJS and VSCodium ready, open the mod.code-workspace file with VSCodium (File->Open Worspace from File...). +Once you have NodeJS and VSCodium ready, open the mod.code-workspace file with VSCodium (File->Open Workspace from File...). Once the project loads into VSCodium you will be recommended to install the ESLint plugin. This is HIGHLY recommended. diff --git a/TypeScript/14AfterDBLoadHook/package.json b/TypeScript/14AfterDBLoadHook/package.json index 838008f..2650df3 100644 --- a/TypeScript/14AfterDBLoadHook/package.json +++ b/TypeScript/14AfterDBLoadHook/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.2.1", + "akiVersion": "3.2.2", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" \"./**/*.*\" ./dist", diff --git a/TypeScript/1LogToConsole/README.md b/TypeScript/1LogToConsole/README.md index efc31a4..b02734f 100644 --- a/TypeScript/1LogToConsole/README.md +++ b/TypeScript/1LogToConsole/README.md @@ -13,7 +13,7 @@ A system reboot may be needed after install. ## **IDE:** -The second step is having an IDE ready. For the currect purpose we've setup a VSCodium workspace file. +The second step is having an IDE ready. We've setup a VSCodium workspace file to help with this. You CAN use Visual Studio Code if you so desire, just keep in mind that our dev tests on the mod files was done using VSCodium. @@ -21,7 +21,7 @@ You can get VSCodium here: https://vscodium.com/#install ## **Workspace:** -Once you have NodeJS and VSCodium ready, open the mod.code-workspace file with VSCodium (File->Open Worspace from File...). +Once you have NodeJS and VSCodium ready, open the mod.code-workspace file with VSCodium (File->Open Workspace from File...). Once the project loads into VSCodium you will be recommended to install the ESLint plugin. This is HIGHLY recommended. diff --git a/TypeScript/1LogToConsole/package.json b/TypeScript/1LogToConsole/package.json index 03a2214..c5e6930 100644 --- a/TypeScript/1LogToConsole/package.json +++ b/TypeScript/1LogToConsole/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.2.1", + "akiVersion": "3.2.2", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" \"./**/*.*\" ./dist", diff --git a/TypeScript/1LogToConsole/types/callbacks/ProfileCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/ProfileCallbacks.d.ts index 6a86fc0..c063243 100644 --- a/TypeScript/1LogToConsole/types/callbacks/ProfileCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/ProfileCallbacks.d.ts @@ -20,7 +20,22 @@ export declare class ProfileCallbacks { createProfile(url: string, info: IProfileCreateRequestData, sessionID: string): IGetBodyResponseData; getProfileData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; regenerateScav(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/profile/voice/change event + * @param url + * @param info Change voice request object + * @param sessionID Session id + * @returns Client response + */ changeVoice(url: string, info: IProfileChangeVoiceRequestData, sessionID: string): INullResponseData; + /** + * Handle client/game/profile/nickname/change event + * Client allows player to adjust their profile name + * @param url + * @param info Change nickname request object + * @param sessionID Session id + * @returns client response + */ changeNickname(url: string, info: IProfileChangeNicknameRequestData, sessionID: string): IGetBodyResponseData; validateNickname(url: string, info: IValidateNicknameRequestData, sessionID: string): IGetBodyResponseData; getReservedNickname(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/TypeScript/1LogToConsole/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/RagfairCallbacks.d.ts index 3a405c9..c609f2f 100644 --- a/TypeScript/1LogToConsole/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/RagfairCallbacks.d.ts @@ -19,6 +19,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; +/** + * Handle ragfair related callback events + */ export declare class RagfairCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; protected logger: ILogger; diff --git a/TypeScript/1LogToConsole/types/controllers/InventoryController.d.ts b/TypeScript/1LogToConsole/types/controllers/InventoryController.d.ts index f57f731..f564919 100644 --- a/TypeScript/1LogToConsole/types/controllers/InventoryController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/InventoryController.d.ts @@ -92,7 +92,11 @@ export declare class InventoryController { */ toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; /** - * Handles Tagging of items (primary Containers). + * Add a tag to an inventory item + * @param pmcData profile with item to add tag to + * @param body tag request data + * @param sessionID session id + * @returns client response object */ tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/1LogToConsole/types/controllers/RagfairController.d.ts b/TypeScript/1LogToConsole/types/controllers/RagfairController.d.ts index c4ffc15..06af740 100644 --- a/TypeScript/1LogToConsole/types/controllers/RagfairController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/RagfairController.d.ts @@ -9,6 +9,7 @@ import { RagfairOfferHelper } from "../helpers/RagfairOfferHelper"; import { RagfairSellHelper } from "../helpers/RagfairSellHelper"; import { RagfairSortHelper } from "../helpers/RagfairSortHelper"; import { RagfairTaxHelper } from "../helpers/RagfairTaxHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; @@ -33,6 +34,9 @@ import { RagfairPriceService } from "../services/RagfairPriceService"; import { RagfairRequiredItemsService } from "../services/RagfairRequiredItemsService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** + * Handle RagfairCallback events + */ export declare class RagfairController { protected logger: ILogger; protected timeUtil: TimeUtil; @@ -52,14 +56,20 @@ export declare class RagfairController { protected handbookHelper: HandbookHelper; protected paymentHelper: PaymentHelper; protected inventoryHelper: InventoryHelper; + protected traderHelper: TraderHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected ragfairOfferGenerator: RagfairOfferGenerator; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + /** + * Update a trader flea offer with buy restrictions stored in the traders assort + * @param offer flea offer to update + */ + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer): void; protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; diff --git a/TypeScript/1LogToConsole/types/controllers/RepeatableQuestController.d.ts b/TypeScript/1LogToConsole/types/controllers/RepeatableQuestController.d.ts index 98d05dd..4c31a3d 100644 --- a/TypeScript/1LogToConsole/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/RepeatableQuestController.d.ts @@ -7,6 +7,7 @@ import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; import { TraderInfo } from "../models/eft/common/tables/IBotBase"; import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; import { ELocationName } from "../models/enums/ELocationName"; @@ -15,6 +16,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -64,9 +66,10 @@ export declare class RepeatableQuestController { protected itemEventRouter: ItemEventRouter; protected paymentService: PaymentService; protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. @@ -217,4 +220,16 @@ export declare class RepeatableQuestController { debugLogRepeatableQuestIds(pmcData: IPmcData): void; probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; changeRepeatableQuest(pmcDataIn: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {*} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; } diff --git a/TypeScript/1LogToConsole/types/di/Container.d.ts b/TypeScript/1LogToConsole/types/di/Container.d.ts index 17791b0..98d1fa1 100644 --- a/TypeScript/1LogToConsole/types/di/Container.d.ts +++ b/TypeScript/1LogToConsole/types/di/Container.d.ts @@ -1,4 +1,7 @@ import { DependencyContainer } from "tsyringe"; +/** + * Handle the registration of classes to be used by the Dependency Injection code + */ export declare class Container { static registerTypes(depContainer: DependencyContainer): void; static registerListTypes(depContainer: DependencyContainer): void; diff --git a/TypeScript/1LogToConsole/types/generators/BotGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/BotGenerator.d.ts index a5fc0ad..7d58f95 100644 --- a/TypeScript/1LogToConsole/types/generators/BotGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/BotGenerator.d.ts @@ -40,7 +40,7 @@ export declare class BotGenerator { * @param botTemplate base bot template to use (e.g. assault/pmcbot) * @returns */ - generatePlayerScav(role: string, difficulty: string, botTemplate: IBotType): IBotBase; + generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; /** * Choose if a bot should become a PMC by checking if bot type is allowed to become a Pmc in botConfig.convertFromChances and doing a random int check @@ -58,7 +58,7 @@ export declare class BotGenerator { * @returns IBotBase object */ protected getCloneOfBotBase(): IBotBase; - protected generateBot(bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + protected generateBot(sessionId: string, bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; /** * Log the number of PMCs generated to the debug console */ diff --git a/TypeScript/1LogToConsole/types/generators/BotInventoryGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/BotInventoryGenerator.d.ts index 35d1ee8..73f8ece 100644 --- a/TypeScript/1LogToConsole/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/BotInventoryGenerator.d.ts @@ -18,7 +18,7 @@ export declare class BotInventoryGenerator { protected botGeneratorHelper: BotGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper); - generateInventory(templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; + generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; protected generateInventoryBase(): PmcInventory; } diff --git a/TypeScript/1LogToConsole/types/generators/BotLootGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/BotLootGenerator.d.ts index c6a3f29..5a2d144 100644 --- a/TypeScript/1LogToConsole/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/BotLootGenerator.d.ts @@ -24,7 +24,7 @@ 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, botLootCacheService: BotLootCacheService, configServer: ConfigServer); - generateLoot(templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; + generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached @@ -47,7 +47,7 @@ export declare class BotLootGenerator { * @param botRole bots role, .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; /** * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from diff --git a/TypeScript/1LogToConsole/types/generators/BotWeaponGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/BotWeaponGenerator.d.ts index 9215214..49fa7bf 100644 --- a/TypeScript/1LogToConsole/types/generators/BotWeaponGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/BotWeaponGenerator.d.ts @@ -28,7 +28,18 @@ export declare class BotWeaponGenerator { protected botConfig: IBotConfig; constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer); /** - * Get a random weapon from a bots pool of weapons (weighted) + * Pick a random weapon based on weightings and generate a functional weapon + * @param equipmentSlot Primary/secondary/holster + * @param botTemplateInventory e.g. assault.json + * @param weaponParentId + * @param modChances + * @param botRole role of bot, e.g. assault/followerBully + * @param isPmc Is weapon generated for a pmc + * @returns GenerateWeaponResult object + */ + generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + /** + * Get a random weighted weapon from a bots pool of weapons * @param equipmentSlot Primary/secondary/holster * @param botTemplateInventory e.g. assault.json * @returns weapon tpl @@ -39,43 +50,24 @@ export declare class BotWeaponGenerator { * @param weaponTpl weapon tpl to generate (use pickWeightedWeaponTplFromPool()) * @param equipmentSlot slot to fit into, primary/secondary/holster * @param botTemplateInventory e.g. assault.json - * @param weaponParentId - * @param modChances - * @param botRole + * @param weaponParentId ParentId of the weapon being generated + * @param modChances Dictionary of item types and % chance weapon will have that mod + * @param botRole e.g. assault/exusec * @param isPmc * @returns GenerateWeaponResult object */ - generateWeaponByTpl(weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; /** - * Generate an entirely random weapon - * @param equipmentSlot Primary/secondary/holster - * @param botTemplateInventory e.g. assault.json - * @param weaponParentId - * @param modChances - * @param botRole - * @param isPmc - * @returns GenerateWeaponResult object - */ - generateRandomWeapon(equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; - /** - * Create array with weapon base as only element - * Add additional properties as required - * @param weaponTpl - * @param weaponParentId - * @param equipmentSlot - * @param weaponItemTemplate + * Create array with weapon base as only element and + * add additional properties based on weapon type + * @param weaponTpl Weapon tpl to create item with + * @param weaponParentId Weapons parent id + * @param equipmentSlot e.g. primary/secondary/holster + * @param weaponItemTemplate db template for weapon * @param botRole for durability values - * @returns + * @returns Base weapon item in array */ constructWeaponBaseArray(weaponTpl: string, weaponParentId: string, equipmentSlot: string, weaponItemTemplate: ITemplateItem, botRole: string): Item[]; - /** - * Add compatible magazines to an inventory based on a generated weapon - * @param weaponDetails - * @param magCounts - * @param inventory - * @param botRole the bot type we're getting generating extra mags for - */ - addExtraMagazinesToInventory(weaponDetails: GenerateWeaponResult, magCounts: MinMax, inventory: PmcInventory, botRole: string): void; /** * Get the mods necessary to kit out a weapon to its preset level * @param weaponTpl weapon to find preset for @@ -84,20 +76,32 @@ export declare class BotWeaponGenerator { * @returns array of weapon mods */ protected getPresetWeaponMods(weaponTpl: string, equipmentSlot: string, weaponParentId: string, itemTemplate: ITemplateItem, botRole: string): Item[]; - /** Checks if all required slots are occupied on a weapon and all it's mods */ + /** + * Checks if all required slots are occupied on a weapon and all it's mods + * @param weaponItemArray Weapon + mods + * @returns true if valid + */ protected isWeaponValid(weaponItemArray: Item[]): boolean; /** * Generates extra magazines or bullets (if magazine is internal) and adds them to TacticalVest and Pockets. * Additionally, adds extra bullets to SecuredContainer - * @param weaponMods - * @param weaponTemplate - * @param magCounts - * @param ammoTpl - * @param inventory + * @param weaponMods mods to attach to weapon + * @param weaponTemplate db template for weapon + * @param magCounts magazine count to add to inventory + * @param ammoTpl ammo templateId to add to magazines + * @param inventory inventory to add magazines to * @param botRole the bot type we're getting generating extra mags for * @returns */ - protected generateExtraMagazines(weaponMods: Item[], weaponTemplate: ITemplateItem, magCounts: MinMax, ammoTpl: string, inventory: PmcInventory, botRole: string): void; + addExtraMagazinesToInventory(weaponMods: Item[], weaponTemplate: ITemplateItem, magCounts: MinMax, ammoTpl: string, inventory: PmcInventory, botRole: string): void; + /** + * Create a magazine using the parameters given + * @param magazineTpl Tpl of the magazine to create + * @param ammoTpl Ammo to add to magazine + * @param magTemplate template object of magazine + * @returns Item array + */ + protected createMagazine(magazineTpl: string, ammoTpl: string, magTemplate: ITemplateItem): Item[]; /** * Get a randomised number of bullets for a specific magazine * @param magCounts min and max count of magazines @@ -138,10 +142,9 @@ export declare class BotWeaponGenerator { * Finds and return a compatible ammo tpl based on the bots ammo weightings (x.json/inventory/equipment/ammo) * @param ammo a list of ammo tpls the weapon can use * @param weaponTemplate the weapon we want to pick ammo for - * @param isPmc is the ammo being gathered for a pmc (runs pmc ammo filtering) * @returns an ammo tpl that works with the desired gun */ - protected getCompatibleAmmo(ammo: Record>, weaponTemplate: ITemplateItem, isPmc: boolean): string; + protected getWeightedCompatibleAmmo(ammo: Record>, weaponTemplate: ITemplateItem): string; /** * Get a weapons compatible cartridge caliber * @param weaponTemplate Weapon to look up caliber of diff --git a/TypeScript/1LogToConsole/types/generators/PMCLootGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/PMCLootGenerator.d.ts index 64e6f7f..b9f2a83 100644 --- a/TypeScript/1LogToConsole/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/PMCLootGenerator.d.ts @@ -1,15 +1,21 @@ import { ItemHelper } from "../helpers/ItemHelper"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ConfigServer } from "../servers/ConfigServer"; import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +/** + * Handle the generation of dynamic PMC loot in pockets and backpacks + * and the removal of blacklisted items + */ export declare class PMCLootGenerator { protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; + protected itemFilterService: ItemFilterService; protected pocketLootPool: string[]; protected backpackLootPool: string[]; protected botConfig: IBotConfig; - constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService); generatePMCPocketLootPool(): string[]; generatePMCBackpackLootPool(): string[]; } diff --git a/TypeScript/1LogToConsole/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/ScavCaseRewardGenerator.d.ts index c7d6ab7..89cb5c8 100644 --- a/TypeScript/1LogToConsole/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/ScavCaseRewardGenerator.d.ts @@ -8,9 +8,13 @@ import { RewardCountAndPriceDetails, ScavCaseRewardCountsAndPrices } from "../mo import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { RagfairPriceService } from "../services/RagfairPriceService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +/** + * Handle the creation of randomised scav case rewards + */ export declare class ScavCaseRewardGenerator { protected logger: ILogger; protected randomUtil: RandomUtil; @@ -18,9 +22,10 @@ export declare class ScavCaseRewardGenerator { protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build * @param body client request diff --git a/TypeScript/1LogToConsole/types/helpers/AssortHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/AssortHelper.d.ts index 15586b9..bfc157f 100644 --- a/TypeScript/1LogToConsole/types/helpers/AssortHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/AssortHelper.d.ts @@ -17,7 +17,7 @@ export declare class AssortHelper { * @param assort assort items from a trader * @returns assort items minus locked quest assorts */ - stripLockedQuestAssort(pmcProfile: IPmcData, traderId: string, assort: ITraderAssort): ITraderAssort; + stripLockedQuestAssort(pmcProfile: IPmcData, traderId: string, assort: ITraderAssort, flea?: boolean): ITraderAssort; /** * Remove assorts from a trader that have not been unlocked yet * @param pmcProfile player profile @@ -32,5 +32,5 @@ export declare class AssortHelper { * @param itemID item id to remove from asort * @returns Modified assort */ - removeItemFromAssort(assort: ITraderAssort, itemID: string): ITraderAssort; + removeItemFromAssort(assort: ITraderAssort, itemID: string, flea?: boolean): ITraderAssort; } diff --git a/TypeScript/1LogToConsole/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/BotGeneratorHelper.d.ts index 3cd7256..cb977f0 100644 --- a/TypeScript/1LogToConsole/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/BotGeneratorHelper.d.ts @@ -3,10 +3,12 @@ import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase" import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem"; import { Grid, ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { ItemFilterService } from "../services/ItemFilterService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -14,6 +16,7 @@ import { ContainerHelper } from "./ContainerHelper"; import { InventoryHelper } from "./InventoryHelper"; import { ItemHelper } from "./ItemHelper"; import { ProbabilityHelper } from "./ProbabilityHelper"; +import { ProfileHelper } from "./ProfileHelper"; export declare class BotGeneratorHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; @@ -25,10 +28,75 @@ export declare class BotGeneratorHelper { protected itemHelper: ItemHelper; protected inventoryHelper: InventoryHelper; protected containerHelper: ContainerHelper; + protected botEquipmentFilterService: BotEquipmentFilterService; + protected itemFilterService: ItemFilterService; + protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, configServer: ConfigServer); - generateModsForItem(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, configServer: ConfigServer); + /** + * TODO - very similar to generateModsForWeapon + * Check mods are compatible and add to array + * @param equipment Equipment item to add mods to + * @param modPool Mod list to choose frm + * @param parentId parentid of item to add mod to + * @param parentTemplate template objet of item to add mods to + * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @returns Item + compatible mods as an array + */ + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + /** + * TODO - very similar to generateModsForEquipment + * @param sessionId session id + * @param weapon Weapon to add mods to + * @param modPool pool of compatible mods to attach to gun + * @param weaponParentId parentId of weapon + * @param parentTemplate + * @param modSpawnChances + * @param ammoTpl ammo tpl to use when generating magazines/cartridges + * @param botRole role of bot weapon is generated for + * @returns Weapon with mods array + */ + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; + /** + * Generate a pool of mods for this bots mod type if bot has values inside `randomisedWeaponModSlots` array found in bot.json/equipment[botrole] + * @param allowedMods Mods to be added to mod pool + * @param botEquipBlacklist blacklist of items not allowed to be added to mod pool + * @param modSlot Slot to generate mods for + * @param itemModPool base mod pool to replace values of + */ + protected generateDynamicModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record): void; + /** + * Check if the specific item type on the weapon has reached the set limit + * @param modTpl item to check is limited + * @param currentCount current number of this item on gun + * @param botRole role of bot we're checking weapon of + * @returns true if at limit + */ + protected weaponModLimitReached(modTpl: string, currentCount: { + count: number; + }, baseTypes: string[], maxLimit: number, botRole: string): boolean; + /** + * log errors if mod is not valid for a slot + * @param modTpl + * @param found + * @param itemSlot + * @param modTemplate + * @param modSlot + * @param parentTemplate + * @returns true if valid + */ + protected isModValidForSlot(modTpl: string, found: boolean, itemSlot: Slot, modTemplate: ITemplateItem, modSlot: string, parentTemplate: ITemplateItem): boolean; + /** + * Create a mod item with parameters as properties + * @param modId _id + * @param modTpl _tpl + * @param parentId parentId + * @param modSlot slotId + * @param modTemplate Used to add additional properites in the upd object + * @returns Item object + */ + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem): Item; /** * Is this magazine cylinder related (revolvers and grenade launchers) * @param magazineParentName the name of the magazines parent @@ -62,11 +130,11 @@ export declare class BotGeneratorHelper { * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" - * - * @param {object} items The items where the CylinderMagazine's camora are appended to - * @param {object} modPool modPool which should include available cartrigdes - * @param {string} parentId The CylinderMagazine's UID - * @param {object} parentTemplate The CylinderMagazine's template + * @param items The items where the CylinderMagazine's camora are appended to + * @param modPool modPool which should include available cartrigdes + * @param parentId The CylinderMagazine's UID + * @param parentTemplate The CylinderMagazine's template + * @returns */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** @@ -75,6 +143,13 @@ export declare class BotGeneratorHelper { * @returns string array of shells fro luitple camora sources */ protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + /** + * Adds properties to an item + * e.g. Repairable / HasHinge / Foldable / MaxDurability + * @param itemTemplate + * @param botRole Used by weapons to randomise the durability values + * @returns Item Upd object with extra properties + */ generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { upd?: Upd; }; @@ -93,12 +168,6 @@ export declare class BotGeneratorHelper { */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; - /** - * Sort by spawn chance, highest to lowest, higher is more common - * @param unsortedModArray String array to sort - * @returns Sorted string array - */ - protected sortModArray(unsortedModArray: string[]): string[]; /** * Can an item be added to an item without issue * @param items @@ -117,8 +186,15 @@ export declare class BotGeneratorHelper { * @returns a `boolean` indicating item was added */ addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: PmcInventory): boolean; + /** + * is the provided item allowed inside a container + * @param slot location item wants to be placed in + * @param itemTpl item being placed + * @returns true if allowed + */ protected itemAllowedInContainer(slot: Grid, itemTpl: string): boolean; } +/** TODO - move into own class */ export declare class ExhaustableArray { private itemPool; private randomUtil; diff --git a/TypeScript/1LogToConsole/types/helpers/HideoutHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/HideoutHelper.d.ts index 36e4009..a822045 100644 --- a/TypeScript/1LogToConsole/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/HideoutHelper.d.ts @@ -49,6 +49,15 @@ export declare class HideoutHelper { protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): HideoutArea; + /** + * + * Filters are deleted when reaching 0 resourceValue + * @param waterFilterArea + * @param pwProd + * @param isGeneratorOn + * @param pmcData + * @returns + */ protected updateWaterFilters(waterFilterArea: HideoutArea, pwProd: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): HideoutArea; diff --git a/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts index 1701c62..0b922f8 100644 --- a/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts @@ -18,18 +18,6 @@ declare class ItemHelper { * @returns boolean; true for items that may be in player posession and not quest items */ isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {*} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - isValidRewardItem(tpl: string): boolean; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - getRewardableItems(): [string, ITemplateItem][]; /** * Check if the tpl / template Id provided is a descendent of the baseclass * diff --git a/TypeScript/1LogToConsole/types/helpers/ProfileHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/ProfileHelper.d.ts index 9d4ff98..4c5ef61 100644 --- a/TypeScript/1LogToConsole/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/ProfileHelper.d.ts @@ -24,6 +24,19 @@ export declare class ProfileHelper { constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; getCompleteProfile(sessionID: string): IPmcData[]; + /** + * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen + * Server saves the post-raid changes prior to the xp screen getting the profile, this results in the xp screen using + * the now updated profile values as a base, meaning it shows x2 xp gained + * Instead, clone the post-raid profile (so we dont alter its values), apply the pre-raid xp values to the cloned objects and return + * Delete snapshot of pre-raid profile prior to returning profile data + * @param sessionId Session id + * @param output pmc and scav profiles array + * @param pmcProfile post-raid pmc profile + * @param scavProfile post-raid scav profile + * @returns updated profile array + */ + postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; /** * Add experience to a PMC inside the players profile diff --git a/TypeScript/1LogToConsole/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/RagfairOfferHelper.d.ts index 8d03bee..0b7317c 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 { constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; - processOffers(sessionID: string): boolean; + processOffersOnProfile(sessionID: string): boolean; protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; diff --git a/TypeScript/1LogToConsole/types/helpers/RagfairSellHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/RagfairSellHelper.d.ts index 6ec004a..91b8a20 100644 --- a/TypeScript/1LogToConsole/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/RagfairSellHelper.d.ts @@ -11,6 +11,12 @@ export declare class RagfairSellHelper { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateSellChance(baseChance: number, offerPrice: number, requirementsPriceInRub: number): number; - rollForSale(sellChance: number, count: number): SellResult[]; + calculateSellChance(baseChancePercent: number, offerPriceRub: number, playerListedPriceRub: number): number; + /** + * Determine if the offer being listed will be sold + * @param sellChancePercent chance item will sell + * @param itemSellCount count of items to sell + * @returns Array of purchases of item(s) lsited + */ + rollForSale(sellChancePercent: number, itemSellCount: number): SellResult[]; } diff --git a/TypeScript/1LogToConsole/types/helpers/RagfairServerHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/RagfairServerHelper.d.ts index e4939d1..a03cdda 100644 --- a/TypeScript/1LogToConsole/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/RagfairServerHelper.d.ts @@ -6,6 +6,7 @@ import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ItemFilterService } from "../services/ItemFilterService"; import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -13,6 +14,9 @@ import { RandomUtil } from "../utils/RandomUtil"; import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { ProfileHelper } from "./ProfileHelper"; +/** + * Helper class for common ragfair server actions + */ export declare class RagfairServerHelper { protected randomUtil: RandomUtil; protected hashUtil: HashUtil; @@ -23,11 +27,12 @@ export declare class RagfairServerHelper { protected localeService: LocaleService; protected dialogueHelper: DialogueHelper; protected jsonUtil: JsonUtil; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; protected static goodsReturnedTemplate: string; - constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); + constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Is item valid / on blacklist / quest item * @param itemDetails diff --git a/TypeScript/1LogToConsole/types/helpers/TradeHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/TradeHelper.d.ts index 975062b..7ab9768 100644 --- a/TypeScript/1LogToConsole/types/helpers/TradeHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/TradeHelper.d.ts @@ -39,6 +39,12 @@ export declare class TradeHelper { * @returns */ sellItem(pmcData: IPmcData, body: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Increment the assorts buy count by number of items purchased + * Show error on screen if player attepts to buy more than what the buy max allows + * @param assortBeingPurchased assort being bought + * @param itemsPurchasedCount number of items being bought + */ protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void; protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void; } diff --git a/TypeScript/1LogToConsole/types/helpers/TraderAssortHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/TraderAssortHelper.d.ts index 677dd66..14eb952 100644 --- a/TypeScript/1LogToConsole/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/TraderAssortHelper.d.ts @@ -41,7 +41,7 @@ export declare class TraderAssortHelper { * @param traderId traders id * @returns a traders' assorts */ - getAssort(sessionId: string, traderId: string): ITraderAssort; + getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort; /** * if the fence assorts have expired, re-generate them * @param pmcProfile Players profile diff --git a/TypeScript/1LogToConsole/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/1LogToConsole/types/models/eft/common/tables/ITemplateItem.d.ts index 23a1a14..6b2fa8f 100644 --- a/TypeScript/1LogToConsole/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/common/tables/ITemplateItem.d.ts @@ -34,6 +34,7 @@ export interface Props { LootExperience?: number; ExamineExperience?: number; HideEntrails?: boolean; + InsuranceDisabled?: boolean; RepairCost?: number; RepairSpeed?: number; ExtraSizeLeft?: number; @@ -206,6 +207,7 @@ export interface Props { IsOneoff?: boolean; MustBoltBeOpennedForExternalReload?: boolean; MustBoltBeOpennedForInternalReload?: boolean; + NoFiremodeOnBoltcatch?: boolean; BoltAction?: boolean; HipAccuracyRestorationDelay?: number; HipAccuracyRestorationSpeed?: number; diff --git a/TypeScript/1LogToConsole/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/1LogToConsole/types/models/eft/common/tables/ITrader.d.ts index a84f5af..37b2d61 100644 --- a/TypeScript/1LogToConsole/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/common/tables/ITrader.d.ts @@ -67,6 +67,7 @@ export interface IBarterScheme { count: number; _tpl: string; onlyFunctional?: boolean; + sptQuestLocked?: boolean; } export interface ISuit { _id: string; diff --git a/TypeScript/1LogToConsole/types/models/eft/ragfair/IRagfairOffer.d.ts b/TypeScript/1LogToConsole/types/models/eft/ragfair/IRagfairOffer.d.ts index 63f655e..141b605 100644 --- a/TypeScript/1LogToConsole/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -15,6 +15,8 @@ export interface IRagfairOffer { name?: string; shortName?: string; loyaltyLevel: number; + buyRestrictionMax?: number; + buyRestrictionCurrent?: number; locked: boolean; unlimitedCount: boolean; summaryCost: number; diff --git a/TypeScript/1LogToConsole/types/models/enums/AmmoTypes.d.ts b/TypeScript/1LogToConsole/types/models/enums/AmmoTypes.d.ts index b52ddcf..254b410 100644 --- a/TypeScript/1LogToConsole/types/models/enums/AmmoTypes.d.ts +++ b/TypeScript/1LogToConsole/types/models/enums/AmmoTypes.d.ts @@ -23,7 +23,7 @@ export declare enum Ammo762x54 { BT_GZH = "5e023d34e8a400319a28ed44", BS_GZH = "5e023d48186a883be655e551" } -export declare enum Ammo338Lapua { +export declare enum Ammo86x70 { TAC_X = "5fc382b6d6fa9c00c571bbc3", UCW = "5fc382c1016cce60e8341b20", AP = "5fc382a9d724d907e2077dab", @@ -85,13 +85,13 @@ export declare enum Ammo9x21 { PE_GZH = "5a26ac06c4a282000c5a90a8", BT_GZH = "5a26ac0ec4a28200741e1e18" } -export declare enum Ammo357Mag { +export declare enum Ammo9x33R { FMJ = "62330b3ed4dc74626d570b95", HOLLOW_POINT = "62330bfadc5883093563729b", SOFT_POINT = "62330c40bdd19b369e1e53d1", JACKET_HP = "62330c18744e5e31df12f516" } -export declare enum Ammo45ACP { +export declare enum Ammo1143x23ACP { MATCH_FMJ = "5e81f423763d9f754677bf2e", HYDRA_SHOK = "5efb0fc6aeb21837e749c801", LASERMATCH_FMJ = "5efb0d4f4bc50b58e81710f3", @@ -126,7 +126,7 @@ export declare enum Ammo556x45 { MK_318_MOD_0_SOST = "60194943740c5d77f6705eea", SSA_AP = "601949593ae8f707c4608daa" } -export declare enum Ammo300Blackout { +export declare enum Ammo762x35 { M62_TRACER = "619636be6db0f2477964e710", BCP_FMJ = "5fbe3ffdf8b6a877a729ea82", AP = "5fd20ff893a8961fc660a954", diff --git a/TypeScript/1LogToConsole/types/models/enums/BaseClasses.d.ts b/TypeScript/1LogToConsole/types/models/enums/BaseClasses.d.ts index e733bca..37c1398 100644 --- a/TypeScript/1LogToConsole/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/1LogToConsole/types/models/enums/BaseClasses.d.ts @@ -68,6 +68,7 @@ export declare enum BaseClasses { ASSAULT_SCOPE = "55818add4bdc2d5b648b456f", REFLEX_SIGHT = "55818ad54bdc2ddc698b4569", TACTICAL_COMBO = "55818b164bdc2ddc698b456c", + FLASHLIGHT = "55818b084bdc2d5b648b4571", MAGAZINE = "5448bc234bdc2d3c308b4569", LIGHT_LASER = "55818b0e4bdc2dde698b456e", FLASH_HIDER = "550aa4bf4bdc2dd6348b456b", diff --git a/TypeScript/1LogToConsole/types/models/enums/ConfigTypes.d.ts b/TypeScript/1LogToConsole/types/models/enums/ConfigTypes.d.ts index 61d6f99..468ece5 100644 --- a/TypeScript/1LogToConsole/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/1LogToConsole/types/models/enums/ConfigTypes.d.ts @@ -8,6 +8,7 @@ export declare enum ConfigTypes { IN_RAID = "aki-inraid", INSURANCE = "aki-insurance", INVENTORY = "aki-inventory", + ITEM = "aki-item", LOCALE = "aki-locale", LOCATION = "aki-location", MATCH = "aki-match", diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IBotConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IBotConfig.d.ts index e171087..82382af 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IBotConfig.d.ts @@ -114,9 +114,16 @@ export interface PmcDynamicLoot { moneyStackLimits: Record; } export interface Equipment { + /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ + weaponModLimits: ModLimits; + randomisedWeaponModSlots?: string[]; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; } +export interface ModLimits { + scopeLimit?: number; + lightLaserLimit?: number; +} export interface EquipmentFilterDetails { levelRange: MinMax; equipment: Record; diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IItemConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IItemConfig.d.ts new file mode 100644 index 0000000..5ecccc2 --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/spt/config/IItemConfig.d.ts @@ -0,0 +1,5 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface IItemConfig extends IBaseConfig { + kind: "aki-item"; + blacklist: string[]; +} diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IQuestConfig.d.ts index be4a97b..c8a2159 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IQuestConfig.d.ts @@ -15,6 +15,10 @@ export interface IRepeatableQuestConfig { locations: Record; traderWhitelist: ITraderWhitelist[]; questConfig: IQuestConfig; + /** Item base types to block when generating rewards */ + rewardBaseTypeBlacklist: string[]; + /** Item tplIds to ignore when generating rewards */ + rewardBlacklist: string[]; } export interface IRewardScaling { levels: number[]; diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IRagfairConfig.d.ts index 6369eda..3088717 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IRagfairConfig.d.ts @@ -12,6 +12,7 @@ export interface Sell { chance: Chance; time: Time; reputation: Reputation; + simulatedSellHours: number; } export interface Chance { base: number; diff --git a/TypeScript/1LogToConsole/types/services/BotEquipmentFilterService.d.ts b/TypeScript/1LogToConsole/types/services/BotEquipmentFilterService.d.ts index e49645b..7a14a4e 100644 --- a/TypeScript/1LogToConsole/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/1LogToConsole/types/services/BotEquipmentFilterService.d.ts @@ -22,7 +22,7 @@ export declare class BotEquipmentFilterService { * @param playerLevel Level of the player * @returns EquipmentBlacklistDetails object */ - protected getBotEquipmentBlacklist(botRole: string, playerLevel: number): EquipmentFilterDetails; + getBotEquipmentBlacklist(botRole: string, playerLevel: number): EquipmentFilterDetails; /** * Get the whitelist for a specific bot type that's within the players level * @param botRole Bot type diff --git a/TypeScript/1LogToConsole/types/services/FenceService.d.ts b/TypeScript/1LogToConsole/types/services/FenceService.d.ts index c9e325e..7c26cdb 100644 --- a/TypeScript/1LogToConsole/types/services/FenceService.d.ts +++ b/TypeScript/1LogToConsole/types/services/FenceService.d.ts @@ -12,6 +12,11 @@ import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { ItemFilterService } from "./ItemFilterService"; +/** + * Handle actions surrounding Fence + * e.g. generating or refreshing assorts / get next refresh time + */ export declare class FenceService { protected logger: ILogger; protected hashUtil: HashUtil; @@ -22,10 +27,11 @@ export declare class FenceService { protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; + protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; getFenceAssorts(): ITraderAssort; /** diff --git a/TypeScript/1LogToConsole/types/services/ItemFilterService.d.ts b/TypeScript/1LogToConsole/types/services/ItemFilterService.d.ts new file mode 100644 index 0000000..c9c8ef3 --- /dev/null +++ b/TypeScript/1LogToConsole/types/services/ItemFilterService.d.ts @@ -0,0 +1,24 @@ +import { IItemConfig } from "../models/spt/config/IItemConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +/** Centralise the handling of blacklisting items, uses blacklist found in config/item.json */ +export declare class ItemFilterService { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected blacklist: string[]; + protected itemConfig: IItemConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Check if the provided template id is blacklisted in config/item.json + * @param tpl template id + * @returns true if blacklisted + */ + isItemBlacklisted(tpl: string): boolean; + /** + * Return every template id blacklisted in config/item.json + * @returns string array of blacklisted tempalte ids + */ + getBlacklistedItems(): string[]; +} diff --git a/TypeScript/1LogToConsole/types/services/ProfileFixerService.d.ts b/TypeScript/1LogToConsole/types/services/ProfileFixerService.d.ts index ed1dec7..9cb5a38 100644 --- a/TypeScript/1LogToConsole/types/services/ProfileFixerService.d.ts +++ b/TypeScript/1LogToConsole/types/services/ProfileFixerService.d.ts @@ -45,6 +45,11 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to find and remove slots from */ protected removeResourcesFromSlotsInHideoutWithoutLocationIndexValue(pmcProfile: IPmcData): void; + /** + * Hideout slots need to be in a specific order, locationIndex in ascending order + * @param pmcProfile profile to edit + */ + protected reorderHideoutAreasWithResouceInputs(pmcProfile: IPmcData): void; /** * add in objects equal to the number of slots * @param areaType area to check diff --git a/TypeScript/1LogToConsole/types/utils/RandomUtil.d.ts b/TypeScript/1LogToConsole/types/utils/RandomUtil.d.ts index c24dd60..e35d21f 100644 --- a/TypeScript/1LogToConsole/types/utils/RandomUtil.d.ts +++ b/TypeScript/1LogToConsole/types/utils/RandomUtil.d.ts @@ -150,4 +150,10 @@ export declare class RandomUtil { */ drawRandomFromDict(dict: any, count?: number, replacement?: boolean): any[]; getBiasedRandomNumber(min: number, max: number, shift: number, n: number): number; + /** + * Fisher-Yates shuffle an array + * @param array Array to shuffle + * @returns Shuffled array + */ + shuffle(array: Array): Array; } diff --git a/TypeScript/1LogToConsole/types/utils/TimeUtil.d.ts b/TypeScript/1LogToConsole/types/utils/TimeUtil.d.ts index f437f8a..1367e26 100644 --- a/TypeScript/1LogToConsole/types/utils/TimeUtil.d.ts +++ b/TypeScript/1LogToConsole/types/utils/TimeUtil.d.ts @@ -1,3 +1,6 @@ +/** + * Utility class to handle time related problems + */ export declare class TimeUtil { static readonly oneHourAsSeconds = 3600; formatTime(date: Date): string; @@ -19,4 +22,10 @@ export declare class TimeUtil { * @returns current date in format: 00.00.0000 (dd.mm.yyyy) */ getDateMailFormat(): string; + /** + * Convert hours into seconds + * @param hours hours to convert to seconds + * @returns number + */ + getHoursAsSeconds(hours: number): number; } diff --git a/TypeScript/2EditDatabase/README.md b/TypeScript/2EditDatabase/README.md index efc31a4..b02734f 100644 --- a/TypeScript/2EditDatabase/README.md +++ b/TypeScript/2EditDatabase/README.md @@ -13,7 +13,7 @@ A system reboot may be needed after install. ## **IDE:** -The second step is having an IDE ready. For the currect purpose we've setup a VSCodium workspace file. +The second step is having an IDE ready. We've setup a VSCodium workspace file to help with this. You CAN use Visual Studio Code if you so desire, just keep in mind that our dev tests on the mod files was done using VSCodium. @@ -21,7 +21,7 @@ You can get VSCodium here: https://vscodium.com/#install ## **Workspace:** -Once you have NodeJS and VSCodium ready, open the mod.code-workspace file with VSCodium (File->Open Worspace from File...). +Once you have NodeJS and VSCodium ready, open the mod.code-workspace file with VSCodium (File->Open Workspace from File...). Once the project loads into VSCodium you will be recommended to install the ESLint plugin. This is HIGHLY recommended. diff --git a/TypeScript/2EditDatabase/package.json b/TypeScript/2EditDatabase/package.json index 0e62610..b8a7ad1 100644 --- a/TypeScript/2EditDatabase/package.json +++ b/TypeScript/2EditDatabase/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.2.1", + "akiVersion": "3.2.2", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" \"./**/*.*\" ./dist", diff --git a/TypeScript/3GetSptConfigFile/README.md b/TypeScript/3GetSptConfigFile/README.md index efc31a4..b02734f 100644 --- a/TypeScript/3GetSptConfigFile/README.md +++ b/TypeScript/3GetSptConfigFile/README.md @@ -13,7 +13,7 @@ A system reboot may be needed after install. ## **IDE:** -The second step is having an IDE ready. For the currect purpose we've setup a VSCodium workspace file. +The second step is having an IDE ready. We've setup a VSCodium workspace file to help with this. You CAN use Visual Studio Code if you so desire, just keep in mind that our dev tests on the mod files was done using VSCodium. @@ -21,7 +21,7 @@ You can get VSCodium here: https://vscodium.com/#install ## **Workspace:** -Once you have NodeJS and VSCodium ready, open the mod.code-workspace file with VSCodium (File->Open Worspace from File...). +Once you have NodeJS and VSCodium ready, open the mod.code-workspace file with VSCodium (File->Open Workspace from File...). Once the project loads into VSCodium you will be recommended to install the ESLint plugin. This is HIGHLY recommended. diff --git a/TypeScript/3GetSptConfigFile/package.json b/TypeScript/3GetSptConfigFile/package.json index 47712ce..fe6575e 100644 --- a/TypeScript/3GetSptConfigFile/package.json +++ b/TypeScript/3GetSptConfigFile/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.2.1", + "akiVersion": "3.2.2", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" \"./**/*.*\" ./dist", diff --git a/TypeScript/4UseACustomConfigFile/README.md b/TypeScript/4UseACustomConfigFile/README.md index efc31a4..b02734f 100644 --- a/TypeScript/4UseACustomConfigFile/README.md +++ b/TypeScript/4UseACustomConfigFile/README.md @@ -13,7 +13,7 @@ A system reboot may be needed after install. ## **IDE:** -The second step is having an IDE ready. For the currect purpose we've setup a VSCodium workspace file. +The second step is having an IDE ready. We've setup a VSCodium workspace file to help with this. You CAN use Visual Studio Code if you so desire, just keep in mind that our dev tests on the mod files was done using VSCodium. @@ -21,7 +21,7 @@ You can get VSCodium here: https://vscodium.com/#install ## **Workspace:** -Once you have NodeJS and VSCodium ready, open the mod.code-workspace file with VSCodium (File->Open Worspace from File...). +Once you have NodeJS and VSCodium ready, open the mod.code-workspace file with VSCodium (File->Open Workspace from File...). Once the project loads into VSCodium you will be recommended to install the ESLint plugin. This is HIGHLY recommended. diff --git a/TypeScript/4UseACustomConfigFile/package.json b/TypeScript/4UseACustomConfigFile/package.json index 8aa8f2b..bd9a0fe 100644 --- a/TypeScript/4UseACustomConfigFile/package.json +++ b/TypeScript/4UseACustomConfigFile/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.2.1", + "akiVersion": "3.2.2", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" \"./**/*.*\" ./dist", diff --git a/TypeScript/5ReplaceMethod/README.md b/TypeScript/5ReplaceMethod/README.md index efc31a4..b02734f 100644 --- a/TypeScript/5ReplaceMethod/README.md +++ b/TypeScript/5ReplaceMethod/README.md @@ -13,7 +13,7 @@ A system reboot may be needed after install. ## **IDE:** -The second step is having an IDE ready. For the currect purpose we've setup a VSCodium workspace file. +The second step is having an IDE ready. We've setup a VSCodium workspace file to help with this. You CAN use Visual Studio Code if you so desire, just keep in mind that our dev tests on the mod files was done using VSCodium. @@ -21,7 +21,7 @@ You can get VSCodium here: https://vscodium.com/#install ## **Workspace:** -Once you have NodeJS and VSCodium ready, open the mod.code-workspace file with VSCodium (File->Open Worspace from File...). +Once you have NodeJS and VSCodium ready, open the mod.code-workspace file with VSCodium (File->Open Workspace from File...). Once the project loads into VSCodium you will be recommended to install the ESLint plugin. This is HIGHLY recommended. diff --git a/TypeScript/5ReplaceMethod/package.json b/TypeScript/5ReplaceMethod/package.json index 045fde4..6fb51be 100644 --- a/TypeScript/5ReplaceMethod/package.json +++ b/TypeScript/5ReplaceMethod/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.2.1", + "akiVersion": "3.2.2", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" \"./**/*.*\" ./dist", diff --git a/TypeScript/6ReferenceAnotherClass/README.md b/TypeScript/6ReferenceAnotherClass/README.md index efc31a4..b02734f 100644 --- a/TypeScript/6ReferenceAnotherClass/README.md +++ b/TypeScript/6ReferenceAnotherClass/README.md @@ -13,7 +13,7 @@ A system reboot may be needed after install. ## **IDE:** -The second step is having an IDE ready. For the currect purpose we've setup a VSCodium workspace file. +The second step is having an IDE ready. We've setup a VSCodium workspace file to help with this. You CAN use Visual Studio Code if you so desire, just keep in mind that our dev tests on the mod files was done using VSCodium. @@ -21,7 +21,7 @@ You can get VSCodium here: https://vscodium.com/#install ## **Workspace:** -Once you have NodeJS and VSCodium ready, open the mod.code-workspace file with VSCodium (File->Open Worspace from File...). +Once you have NodeJS and VSCodium ready, open the mod.code-workspace file with VSCodium (File->Open Workspace from File...). Once the project loads into VSCodium you will be recommended to install the ESLint plugin. This is HIGHLY recommended. diff --git a/TypeScript/6ReferenceAnotherClass/package.json b/TypeScript/6ReferenceAnotherClass/package.json index d8ca54d..4041fc4 100644 --- a/TypeScript/6ReferenceAnotherClass/package.json +++ b/TypeScript/6ReferenceAnotherClass/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.2.1", + "akiVersion": "3.2.2", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" \"\"./**/*.*\"\" ./dist", diff --git a/TypeScript/7OnLoadHook/README.md b/TypeScript/7OnLoadHook/README.md index efc31a4..b02734f 100644 --- a/TypeScript/7OnLoadHook/README.md +++ b/TypeScript/7OnLoadHook/README.md @@ -13,7 +13,7 @@ A system reboot may be needed after install. ## **IDE:** -The second step is having an IDE ready. For the currect purpose we've setup a VSCodium workspace file. +The second step is having an IDE ready. We've setup a VSCodium workspace file to help with this. You CAN use Visual Studio Code if you so desire, just keep in mind that our dev tests on the mod files was done using VSCodium. @@ -21,7 +21,7 @@ You can get VSCodium here: https://vscodium.com/#install ## **Workspace:** -Once you have NodeJS and VSCodium ready, open the mod.code-workspace file with VSCodium (File->Open Worspace from File...). +Once you have NodeJS and VSCodium ready, open the mod.code-workspace file with VSCodium (File->Open Workspace from File...). Once the project loads into VSCodium you will be recommended to install the ESLint plugin. This is HIGHLY recommended. diff --git a/TypeScript/7OnLoadHook/package.json b/TypeScript/7OnLoadHook/package.json index 5ff1578..f8a9d7e 100644 --- a/TypeScript/7OnLoadHook/package.json +++ b/TypeScript/7OnLoadHook/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.2.1", + "akiVersion": "3.2.2", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" \"./**/*.*\" ./dist", diff --git a/TypeScript/8OnUpdateHook/README.md b/TypeScript/8OnUpdateHook/README.md index efc31a4..b02734f 100644 --- a/TypeScript/8OnUpdateHook/README.md +++ b/TypeScript/8OnUpdateHook/README.md @@ -13,7 +13,7 @@ A system reboot may be needed after install. ## **IDE:** -The second step is having an IDE ready. For the currect purpose we've setup a VSCodium workspace file. +The second step is having an IDE ready. We've setup a VSCodium workspace file to help with this. You CAN use Visual Studio Code if you so desire, just keep in mind that our dev tests on the mod files was done using VSCodium. @@ -21,7 +21,7 @@ You can get VSCodium here: https://vscodium.com/#install ## **Workspace:** -Once you have NodeJS and VSCodium ready, open the mod.code-workspace file with VSCodium (File->Open Worspace from File...). +Once you have NodeJS and VSCodium ready, open the mod.code-workspace file with VSCodium (File->Open Workspace from File...). Once the project loads into VSCodium you will be recommended to install the ESLint plugin. This is HIGHLY recommended. diff --git a/TypeScript/8OnUpdateHook/package.json b/TypeScript/8OnUpdateHook/package.json index 2f62626..9fe2dbd 100644 --- a/TypeScript/8OnUpdateHook/package.json +++ b/TypeScript/8OnUpdateHook/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.2.1", + "akiVersion": "3.2.2", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" \"./**/*.*\" ./dist", diff --git a/TypeScript/9RouterHooks/README.md b/TypeScript/9RouterHooks/README.md index efc31a4..b02734f 100644 --- a/TypeScript/9RouterHooks/README.md +++ b/TypeScript/9RouterHooks/README.md @@ -13,7 +13,7 @@ A system reboot may be needed after install. ## **IDE:** -The second step is having an IDE ready. For the currect purpose we've setup a VSCodium workspace file. +The second step is having an IDE ready. We've setup a VSCodium workspace file to help with this. You CAN use Visual Studio Code if you so desire, just keep in mind that our dev tests on the mod files was done using VSCodium. @@ -21,7 +21,7 @@ You can get VSCodium here: https://vscodium.com/#install ## **Workspace:** -Once you have NodeJS and VSCodium ready, open the mod.code-workspace file with VSCodium (File->Open Worspace from File...). +Once you have NodeJS and VSCodium ready, open the mod.code-workspace file with VSCodium (File->Open Workspace from File...). Once the project loads into VSCodium you will be recommended to install the ESLint plugin. This is HIGHLY recommended. diff --git a/TypeScript/9RouterHooks/package.json b/TypeScript/9RouterHooks/package.json index 2b43e2d..1987b20 100644 --- a/TypeScript/9RouterHooks/package.json +++ b/TypeScript/9RouterHooks/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.2.1", + "akiVersion": "3.2.2", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" \"./**/*.*\" ./dist",