From 0bf5c06cfe3915c094cc06f9f3809e82fb3443b8 Mon Sep 17 00:00:00 2001 From: Chomp Date: Sat, 3 Dec 2022 09:57:08 +0000 Subject: [PATCH] Update types for 3.4.0 --- .../types/callbacks/DataCallbacks.d.ts | 3 +- .../types/controllers/GameController.d.ts | 33 +-- .../generators/BotEquipmentModGenerator.d.ts | 181 +++++++++++++++ .../types/generators/BotGenerator.d.ts | 13 +- .../generators/BotInventoryGenerator.d.ts | 15 +- .../types/generators/BotWeaponGenerator.d.ts | 6 +- .../types/generators/LocationGenerator.d.ts | 6 +- .../types/helpers/BotGeneratorHelper.d.ts | 211 +----------------- .../types/helpers/GameEventHelper.d.ts | 22 +- .../types/helpers/ItemHelper.d.ts | 11 +- .../models/eft/game/IGameConfigResponse.d.ts | 2 + .../eft/hideout/IHideoutProduction.d.ts | 2 +- .../types/models/enums/BaseClasses.d.ts | 6 +- .../models/spt/callbacks/IDataCallbacks.d.ts | 3 +- .../types/models/spt/config/IBotConfig.d.ts | 1 + .../types/models/spt/server/ILocaleBase.d.ts | 48 +--- .../models/spt/server/ISettingsBase.d.ts | 4 + .../services/BotEquipmentFilterService.d.ts | 12 + .../services/BotEquipmentModPoolService.d.ts | 65 ++++++ .../services/BotWeaponModLimitService.d.ts | 54 +++++ .../types/services/ItemBaseClassService.d.ts | 2 +- .../types/services/LocaleService.d.ts | 5 +- .../types/services/SeasonalEventService.d.ts | 69 ++++++ 23 files changed, 450 insertions(+), 324 deletions(-) create mode 100644 TypeScript/1LogToConsole/types/generators/BotEquipmentModGenerator.d.ts create mode 100644 TypeScript/1LogToConsole/types/services/BotEquipmentModPoolService.d.ts create mode 100644 TypeScript/1LogToConsole/types/services/BotWeaponModLimitService.d.ts create mode 100644 TypeScript/1LogToConsole/types/services/SeasonalEventService.d.ts diff --git a/TypeScript/1LogToConsole/types/callbacks/DataCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/DataCallbacks.d.ts index 2efcf81..1f359e5 100644 --- a/TypeScript/1LogToConsole/types/callbacks/DataCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/DataCallbacks.d.ts @@ -8,7 +8,6 @@ import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutScavCase } from "../models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "../models/eft/hideout/IHideoutSettingsBase"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { ILanguageBase } from "../models/spt/server/ILocaleBase"; import { ISettingsBase } from "../models/spt/server/ISettingsBase"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -54,7 +53,7 @@ export declare class DataCallbacks { getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/1LogToConsole/types/controllers/GameController.d.ts b/TypeScript/1LogToConsole/types/controllers/GameController.d.ts index d8f2e67..0136961 100644 --- a/TypeScript/1LogToConsole/types/controllers/GameController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/GameController.d.ts @@ -1,63 +1,37 @@ import { ApplicationContext } from "../context/ApplicationContext"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Config } from "../models/eft/common/IGlobals"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IServerDetails } from "../models/eft/game/IServerDetails"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { ISeasonalEvent } from "../models/spt/config/ISeasonalEventConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; -import { LocaleService } from "../services/LocaleService"; import { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; -import { Watermark } from "../utils/Watermark"; +import { SeasonalEventService } from "../services/SeasonalEventService"; export declare class GameController { protected logger: ILogger; protected databaseServer: DatabaseServer; - protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; - protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; 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); + constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, 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 - */ - protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; - /** - * Make adjusted to server code based on the name of the event passed in - * @param globalConfig globals.json - * @param eventName Name of the event to enable. e.g. Christmas - */ - protected updateGlobalEvents(globalConfig: Config, eventName: string): void; - /** - * Read in data from seasonalEvents.json and add found equipment items to bots - * @param eventName Name of the event to read equipment in from config - */ - protected addEventGearToScavs(eventName: string): void; - /** - * Set Khorovod(dancing tree) chance to 100% on all maps that support it - */ - protected enableDancingTree(): void; /** * Make non-trigger-spawned raiders spawn earlier + always */ @@ -65,6 +39,5 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): IServerDetails[]; - protected addPumpkinsToScavBackpacks(): void; getValidGameVersion(): ICheckVersionResponse; } diff --git a/TypeScript/1LogToConsole/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/BotEquipmentModGenerator.d.ts new file mode 100644 index 0000000..ae25ebe --- /dev/null +++ b/TypeScript/1LogToConsole/types/generators/BotEquipmentModGenerator.d.ts @@ -0,0 +1,181 @@ +import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotHelper } from "../helpers/BotHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { ProbabilityHelper } from "../helpers/ProbabilityHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; +import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { HashUtil } from "../utils/HashUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotEquipmentModGenerator { + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; + protected randomUtil: RandomUtil; + protected probabilityHelper: ProbabilityHelper; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected botEquipmentFilterService: BotEquipmentFilterService; + protected itemFilterService: ItemFilterService; + protected profileHelper: ProfileHelper; + protected botWeaponModLimitService: BotWeaponModLimitService; + protected botHelper: BotHelper; + protected botGeneratorHelper: BotGeneratorHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; + protected botEquipmentModPoolService: BotEquipmentModPoolService; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + /** + * 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 + * @param botRole the bot role being generated for + * @param forceSpawn should this mod be forced to spawn + * @returns Item + compatible mods as an array + */ + 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 + * @param weaponParentId parentId of weapon + * @param parentWeaponTemplate Weapon which mods will be generated on + * @param modSpawnChances Mod spawn chances + * @param ammoTpl Ammo tpl to use when generating magazines/cartridges + * @param botRole Role of bot weapon is generated for + * @param botLevel lvel of the bot weapon is being generated for + * @param modLimits limits placed on certian mod types per gun + * @param botEquipmentRole role of bot when accessing bot.json equipment config settings + * @returns Weapon + mods array + */ + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string, botLevel: number, modLimits: BotModLimits, botEquipmentRole: string): Item[]; + /** + * Get a Slot property for an item (chamber/cartridge/slot) + * @param modSlot e.g patron_in_weapon + * @param parentTemplate item template + * @returns Slot item + */ + protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + /** + * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * never return true for an item that has 0% spawn chance + * @param itemSlot slot the item sits in + * @param modSlot slot the mod sits in + * @param modSpawnChances Chances for various mod spawns + * @returns boolean true if it should spawn + */ + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + /** + * + * @param modSlot Slot mod will fit into + * @param isRandomisableSlot Will generate a randomised mod pool if true + * @param modsParent Parent slot the item will be a part of + * @param botEquipBlacklist Blacklist to prevent mods from being picked + * @param itemModPool Pool of items to pick from + * @param weapon array with only weapon tpl in it, ready for mods to be added + * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) + * @param parentTemplate Parent item the mod will go into + * @returns ITemplateItem + */ + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + /** + * 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, botRole: string): Item; + /** + * Get a list of containers that hold ammo + * e.g. mod_magazine / patron_in_weapon_000 + * @returns string array + */ + protected getAmmoContainers(): string[]; + /** + * Get a random mod from an items compatible mods Filter array + * @param modTpl ???? default value to return if nothing found + * @param parentSlot item mod will go into, used to get combatible items + * @param modSlot Slot to get mod to fill + * @param items items to ensure picked mod is compatible with + * @returns item tpl + */ + protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; + /** + * Log errors if mod is not compatible with slot + * @param modToAdd template of mod to check + * @param itemSlot slot the item will be placed in + * @param modSlot slot the mod will fill + * @param parentTemplate tempalte of the mods parent item + * @returns true if valid + */ + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + /** + * Find mod tpls of a provided type and add to modPool + * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) + * @param modTemplate db object for modItem we get compatible mods from + * @param modPool Pool of mods we are adding to + */ + protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; + /** + * Get the possible items that fit a slot + * @param parentItemId item tpl to get compatible items for + * @param modSlot Slot item should fit in + * @param botEquipBlacklist equipment that should not be picked + * @returns array of compatible items for that slot + */ + protected getDynamicModPool(parentItemId: string, modSlot: string, botEquipBlacklist: EquipmentFilterDetails): string[]; + /** + * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist + * @param allowedMods base mods to filter + * @param botEquipBlacklist equipment blacklist + * @param modSlot slot mods belong to + * @returns Filtered array of mod tpls + */ + protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; + /** + * With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. + * 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 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 + */ + protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; + /** + * Take a record of camoras and merge the compatable shells into one array + * @param camorasWithShells camoras we want to merge into one array + * @returns string array of shells fro luitple camora sources + */ + protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + /** + * Filter out non-whitelisted weapon scopes + * @param weapon Weapon scopes will be added to + * @param scopes Full scope pool + * @param botWeaponSightWhitelist whitelist of scope types by weapon base type + * @returns array of scope tpls that have been filtered + */ + protected filterSightsByWeaponType(weapon: Item, scopes: string[], botWeaponSightWhitelist: Record): string[]; +} diff --git a/TypeScript/1LogToConsole/types/generators/BotGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/BotGenerator.d.ts index 5bf52f1..2675146 100644 --- a/TypeScript/1LogToConsole/types/generators/BotGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/BotGenerator.d.ts @@ -1,16 +1,16 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; -import { GameEventHelper } from "../helpers/GameEventHelper"; 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 { Health, IBotType } 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"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { SeasonalEventService } from "../services/SeasonalEventService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -29,10 +29,10 @@ export declare class BotGenerator { protected weightedRandomHelper: WeightedRandomHelper; protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - 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); + 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, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -83,11 +83,6 @@ export declare class BotGenerator { */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; protected generateSkills(skillsObj: Skills): Skills; - /** - * Iterate through bots inventory and loot to find and remove christmas items (as defined in GameEventHelper) - * @param nodeInventory Bots inventory to iterate over - */ - protected removeChristmasItemsFromBotInventory(nodeInventory: Inventory): void; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/1LogToConsole/types/generators/BotInventoryGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/BotInventoryGenerator.d.ts index a3b5eaa..83a548b 100644 --- a/TypeScript/1LogToConsole/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/BotInventoryGenerator.d.ts @@ -4,13 +4,15 @@ import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; import { Chances, Generation, IBotType, Inventory, Mods } from "../models/eft/common/tables/IBotType"; import { EquipmentSlots } from "../models/enums/EquipmentSlots"; -import { IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; import { BotLootGenerator } from "./BotLootGenerator"; import { BotWeaponGenerator } from "./BotWeaponGenerator"; export declare class BotInventoryGenerator { @@ -24,9 +26,11 @@ export declare class BotInventoryGenerator { protected botHelper: BotHelper; protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected botEquipmentModPoolService: BotEquipmentModPoolService; + protected botEquipmentModGenerator: BotEquipmentModGenerator; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, botHelper: BotHelper, 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, botEquipmentModPoolService: BotEquipmentModPoolService, botEquipmentModGenerator: BotEquipmentModGenerator, configServer: ConfigServer); /** * Add equipment/weapons/loot to bot * @param sessionId Session id @@ -62,6 +66,13 @@ export declare class BotInventoryGenerator { * @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; + /** + * Get all possible mods for item and filter down based on equipment blacklist from bot.json config + * @param itemTpl Item mod pool is being retreived and filtered + * @param equipmentBlacklist blacklist to filter mod pool with + * @returns Filtered pool of mods + */ + protected getFilteredDynamicModsForItem(itemTpl: string, equipmentBlacklist: EquipmentFilterDetails[]): Record; /** * Work out what weapons bot should have equipped and add them to bot inventory * @param templateInventory bot/x.json data from db diff --git a/TypeScript/1LogToConsole/types/generators/BotWeaponGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/BotWeaponGenerator.d.ts index b2eaf3b..938d61c 100644 --- a/TypeScript/1LogToConsole/types/generators/BotWeaponGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/BotWeaponGenerator.d.ts @@ -12,10 +12,12 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; import { IInventoryMagGen } from "./weapongen/IInventoryMagGen"; export declare class BotWeaponGenerator { protected jsonUtil: JsonUtil; @@ -28,11 +30,13 @@ export declare class BotWeaponGenerator { protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botWeaponModLimitService: BotWeaponModLimitService; + protected botEquipmentModGenerator: BotEquipmentModGenerator; protected localisationService: LocalisationService; protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botWeaponModLimitService: BotWeaponModLimitService, botEquipmentModGenerator: BotEquipmentModGenerator, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); /** * Pick a random weapon based on weightings and generate a functional weapon * @param equipmentSlot Primary/secondary/holster diff --git a/TypeScript/1LogToConsole/types/generators/LocationGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/LocationGenerator.d.ts index aafe758..a80ae3c 100644 --- a/TypeScript/1LogToConsole/types/generators/LocationGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/LocationGenerator.d.ts @@ -1,5 +1,4 @@ import { ContainerHelper } from "../helpers/ContainerHelper"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; @@ -10,6 +9,7 @@ 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 { SeasonalEventService } from "../services/SeasonalEventService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; @@ -27,13 +27,13 @@ export declare class LocationGenerator { protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; 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, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, 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/helpers/BotGeneratorHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/BotGeneratorHelper.d.ts index cdb530c..740805b 100644 --- a/TypeScript/1LogToConsole/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/BotGeneratorHelper.d.ts @@ -1,207 +1,24 @@ import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper"; -import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem"; -import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; -import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; -import { ItemFilterService } from "../services/ItemFilterService"; 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"; import { ItemHelper } from "./ItemHelper"; -import { ProbabilityHelper } from "./ProbabilityHelper"; -import { ProfileHelper } from "./ProfileHelper"; -export declare class BotModLimits { - scope: ItemCount; - scopeMax: number; - scopeBaseTypes: string[]; - flashlightLaser: ItemCount; - flashlightLaserMax: number; - flashlgihtLaserBaseTypes: string[]; -} -export declare class ItemCount { - count: number; -} export declare class BotGeneratorHelper { protected logger: ILogger; - protected jsonUtil: JsonUtil; - protected hashUtil: HashUtil; protected randomUtil: RandomUtil; - protected probabilityHelper: ProbabilityHelper; protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; - protected inventoryHelper: InventoryHelper; - protected containerHelper: ContainerHelper; - protected botEquipmentFilterService: BotEquipmentFilterService; - 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, botHelper: BotHelper, localisationService: LocalisationService, configServer: ConfigServer); - /** - * 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 - * @param botRole the bot role being generated for - * @param forceSpawn should this mod be forced to spawn - * @returns Item + compatible mods as an array - */ - 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 - * @param weaponParentId parentId of weapon - * @param parentWeaponTemplate Weapon which mods will be generated on - * @param modSpawnChances Mod spawn chances - * @param ammoTpl Ammo tpl to use when generating magazines/cartridges - * @param botRole Role of bot weapon is generated for - * @returns Weapon + mods array - */ - generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string, botLevel: number): Item[]; - /** - * - * @param modSlot Slot mod will fit into - * @param isRandomisableSlot Will generate a randomised mod pool if true - * @param modsParent Parent slot the item will be a part of - * @param botEquipBlacklist Blacklist to prevent mods from being picked - * @param itemModPool Pool of items to pick from - * @param weapon array with only weapon tpl in it, ready for mods to be added - * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) - * @param parentTemplate Parent item the mod will go into - * @returns ITemplateItem - */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; - /** - * Find mod tpls of a provided type and add to modPool - * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) - * @param modTemplate db object for modItem we get compatible mods from - * @param modPool Pool of mods we are adding to - */ - protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; - /** - * Check if mod item is on limited list + has surpassed the limit set for it - * @param botRole role the bot has e.g. assault - * @param modTemplate mods template data - * @param modLimits limits set for weapon being generated for this bot - * @returns true if over item limit - */ - protected modHasReachedItemLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits): boolean; - /** - * Initalise mod limits to be used when generating a weapon - * @param botRole "assault", "bossTagilla" or "pmc" - * @returns BotModLimits object - */ - protected initModLimits(botRole: string): BotModLimits; - /** - * Generate a pool of mods for this bots mod type if bot has values inside `randomisedWeaponModSlots` array found in bot.json/equipment[botrole] - * @param allowedMods Mods to be added to mod pool - * @param botEquipBlacklist blacklist of items not allowed to be added to mod pool - * @param modSlot Slot to generate mods for - * @param itemModPool base mod pool to replace values of - */ - protected generateDynamicWeaponModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record): void; - /** - * Find all compatible mods for equipment item and add to modPool - * @param itemDetails item to find mods for - * @param modPool ModPool to add mods to - * @param equipmentBlacklist equipment not allowed to be used by the bot - * @param botEquipmentRole bot type to generate pool for (e.g. assault, pmcBot, pmc for usec/bear) - */ - generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods, equipmentBlacklist: EquipmentFilterDetails[], botEquipmentRole: string): void; - /** - * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist - * @param allowedMods base mods to filter - * @param botEquipBlacklist equipment blacklist - * @param modSlot slot mods belong to - * @returns Filtered array of mod tpls - */ - protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; - /** - * Check if the specific item type on the weapon has reached the set limit - * @param modTpl log mod tpl if over type limit - * @param currentCount current number of this item on gun - * @param maxLimit mod limit allowed - * @param botRole role of bot we're checking weapon of - * @returns true if limit reached - */ - protected weaponModLimitReached(modTpl: string, currentCount: { - count: number; - }, maxLimit: number, botRole: string): boolean; - /** - * Log errors if mod is not compatible with slot - * @param modToAdd template of mod to check - * @param itemSlot slot the item will be placed in - * @param modSlot slot the mod will fill - * @param parentTemplate tempalte of the mods parent item - * @returns true if valid - */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; - /** - * Create a mod item with parameters as properties - * @param modId _id - * @param modTpl _tpl - * @param parentId parentId - * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object - * @returns Item object - */ - protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; - /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot - * never return true for an item that has 0% spawn chance - * @param itemSlot slot the item sits in - * @param modSlot slot the mod sits in - * @param modSpawnChances Chances for various mod spawns - * @returns boolean true if it should spawn - */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; - /** - * Get a list of containers that hold ammo - * e.g. mod_magazine / patron_in_weapon_000 - * @returns string array - */ - protected getAmmoContainers(): string[]; - /** - * Get a Slot property for an item (chamber/cartridge/slot) - * @param modSlot e.g patron_in_weapon - * @param parentTemplate item template - * @returns Slot item - */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; - /** - * With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. - * 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 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 - */ - protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; - /** - * Take a record of camoras and merge the compatable shells into one array - * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources - */ - protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -239,22 +56,16 @@ export declare class BotGeneratorHelper { */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; /** - * Get a random mod from an items compatible mods Filter array - * @param modTpl ???? - * @param parentSlot item mod will go into, used to get combatible items - * @param modSlot Slot to get mod to fill - * @param items items to ensure picked mod is compatible with - * @returns item tpl - */ - protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; - /** - * Can an item be added to an item without issue - * @param items items to check compatiblilities with - * @param tplToCheck tpl of the item to check for incompatibilities + * Can item be added to another item without conflict + * @param items Items to check compatiblilities with + * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into - * @returns false if no incompatibilties + * @returns false if no incompatibilties, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; + isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { + incompatible: boolean; + reason: string; + }; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert diff --git a/TypeScript/1LogToConsole/types/helpers/GameEventHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/GameEventHelper.d.ts index fa25eff..f502c95 100644 --- a/TypeScript/1LogToConsole/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/GameEventHelper.d.ts @@ -1,4 +1,4 @@ -import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; export declare class GameEventHelper { @@ -6,24 +6,4 @@ export declare class GameEventHelper { protected configServer: ConfigServer; protected seasonalEventConfig: ISeasonalEventConfig; constructor(databaseServer: DatabaseServer, configServer: ConfigServer); - get events(): Record; - get christmasEventItems(): string[]; - itemIsChristmasRelated(itemId: string): boolean; - christmasEventEnabled(): boolean; - /** - * Get the dates each seasonal event starts and ends - * @returns Record with event name + start/end date - */ - getEventDetails(): ISeasonalEvent[]; - /** - * Is detection of seasonal events enabled (halloween / christmas) - * @returns true if seasonal events should be checked for - */ - isAutomaticEventDetectionEnabled(): boolean; - /** - * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween - * @param eventName Name of event to get gear changes for - * @returns bots with equipment changes - */ - getEventBotGear(eventName: string): Record>>; } diff --git a/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts index 28aab66..36ad1cf 100644 --- a/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts @@ -37,10 +37,17 @@ declare class ItemHelper { * Check if the tpl / template Id provided is a descendent of the baseclass * * @param {string} tpl the item template id to check - * @param {string} baseclassTpl the baseclass to check for + * @param {string} baseClassTpl the baseclass to check for * @return {boolean} is the tpl a descendent? */ - isOfBaseclass(tpl: string, baseclassTpl: string): boolean; + isOfBaseclass(tpl: string, baseClassTpl: string): boolean; + /** + * Check if item has any of the supplied base clases + * @param tpl Item to check base classes of + * @param baseClassTpls base classes to check for + * @returns true if any supplied base classes match + */ + isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; /** * Returns the item price based on the handbook or as a fallback from the prices.json if the item is not * found in the handbook. If the price can't be found at all return 0 diff --git a/TypeScript/1LogToConsole/types/models/eft/game/IGameConfigResponse.d.ts b/TypeScript/1LogToConsole/types/models/eft/game/IGameConfigResponse.d.ts index eb37a39..e1b7587 100644 --- a/TypeScript/1LogToConsole/types/models/eft/game/IGameConfigResponse.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/game/IGameConfigResponse.d.ts @@ -7,11 +7,13 @@ export interface IGameConfigResponse { activeProfileId: string; backend: Backend; utc_time: number; + /** Total in game time */ totalInGame: number; reportAvailable: boolean; twitchEventMember: boolean; } export interface Backend { + Lobby: string; Trading: string; Messaging: string; Main: string; diff --git a/TypeScript/1LogToConsole/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/1LogToConsole/types/models/eft/hideout/IHideoutProduction.d.ts index ce878be..9295fb1 100644 --- a/TypeScript/1LogToConsole/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,7 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; - boosters: any; + boosters?: any; endProduct: string; continuous: boolean; count: number; diff --git a/TypeScript/1LogToConsole/types/models/enums/BaseClasses.d.ts b/TypeScript/1LogToConsole/types/models/enums/BaseClasses.d.ts index 4eb6f7e..7d11510 100644 --- a/TypeScript/1LogToConsole/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/1LogToConsole/types/models/enums/BaseClasses.d.ts @@ -8,6 +8,8 @@ export declare enum BaseClasses { BACKPACK = "5448e53e4bdc2d60728b4567", VISORS = "5448e5724bdc2ddf718b4568", FOOD = "5448e8d04bdc2ddf718b4569", + GAS_BLOCK = "56ea9461d2720b67698b456f", + RAIL_COVER = "55818b1d4bdc2d5b648b4572", DRINK = "5448e8d64bdc2dce718b4568", BARTER_ITEM = "5448eb774bdc2d0a728b4567", INFO = "5448ecbe4bdc2d60728b4568", @@ -36,6 +38,7 @@ export declare enum BaseClasses { THROW_WEAPON = "543be6564bdc2df4348b4568", FOOD_DRINK = "543be6674bdc2df1348b4569", PISTOL = "5447b5cf4bdc2d65278b4567", + REVOLVER = "617f1ef5e8b54b0998387733", SMG = "5447b5e04bdc2d62278b4567", ASSAULT_RIFLE = "5447b5f14bdc2d61278b4567", ASSAULT_CARBINE = "5447b5fc4bdc2d87278b4567", @@ -73,9 +76,10 @@ export declare enum BaseClasses { TACTICAL_COMBO = "55818b164bdc2ddc698b456c", FLASHLIGHT = "55818b084bdc2d5b648b4571", MAGAZINE = "5448bc234bdc2d3c308b4569", - LIGHT_LASER = "55818b0e4bdc2dde698b456e", + LIGHT_LASER_DESIGNATOR = "55818b0e4bdc2dde698b456e", FLASH_HIDER = "550aa4bf4bdc2dd6348b456b", COLLIMATOR = "55818ad54bdc2ddc698b4569", + IRON_SIGHT = "55818ac54bdc2d5b648b456e", COMPACT_COLLIMATOR = "55818acf4bdc2dde698b456b", COMPENSATOR = "550aa4af4bdc2dd4348b456e", OPTIC_SCOPE = "55818ae44bdc2dde698b456c", diff --git a/TypeScript/1LogToConsole/types/models/spt/callbacks/IDataCallbacks.d.ts b/TypeScript/1LogToConsole/types/models/spt/callbacks/IDataCallbacks.d.ts index a098560..b4f4f8c 100644 --- a/TypeScript/1LogToConsole/types/models/spt/callbacks/IDataCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/callbacks/IDataCallbacks.d.ts @@ -6,7 +6,6 @@ import { IHideoutProduction } from "../../eft/hideout/IHideoutProduction"; import { IHideoutScavCase } from "../../eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "../../eft/hideout/IHideoutSettingsBase"; import { IGetBodyResponseData } from "../../eft/httpResponse/IGetBodyResponseData"; -import { ILanguageBase } from "../server/ILocaleBase"; import { ISettingsBase } from "../server/ISettingsBase"; export interface IDataCallbacks { getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -20,7 +19,7 @@ export interface IDataCallbacks { getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IBotConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IBotConfig.d.ts index 83897db..e17992c 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IBotConfig.d.ts @@ -66,6 +66,7 @@ export interface LootNvalue { } export interface EquipmentFilters { weaponModLimits: ModLimits; + weaponSightWhitelist: Record; faceShieldIsActiveChancePercent?: number; lightLaserIsActiveChancePercent?: number; randomisation: RandomisationDetails[]; diff --git a/TypeScript/1LogToConsole/types/models/spt/server/ILocaleBase.d.ts b/TypeScript/1LogToConsole/types/models/spt/server/ILocaleBase.d.ts index 6e20b89..3cdaf6f 100644 --- a/TypeScript/1LogToConsole/types/models/spt/server/ILocaleBase.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/server/ILocaleBase.d.ts @@ -1,49 +1,5 @@ export interface ILocaleBase { - global: Record; + global: Record>; menu: Record; - languages: ILanguageBase[]; -} -export interface ILocaleGlobalBase { - interface: Record; - enum: any[]; - mail: Record; - quest: Record; - preset: Record; - handbook: Record; - season: Record; - customization: Record; - repeatableQuest: Record; - templates: Record; - locations: Record; - banners: Record; - trading: Record; -} -export interface ILocaleQuest { - name: string; - description: string; - note: string; - failMessageText: string; - startedMessageText: string; - successMessageText: string; - conditions: Record; - location: string; -} -export interface ILocalePreset { - Name: string; -} -export interface ILocaleProps { - Name: string; - ShortName: string; - Description: string; -} -export interface ILocaleTradingProps { - FullName: string; - FirstName: string; - Nickname: string; - Location: string; - Description: string; -} -export interface ILanguageBase { - ShortName: string; - Name: string; + languages: Record; } diff --git a/TypeScript/1LogToConsole/types/models/spt/server/ISettingsBase.d.ts b/TypeScript/1LogToConsole/types/models/spt/server/ISettingsBase.d.ts index c067cda..625ad5c 100644 --- a/TypeScript/1LogToConsole/types/models/spt/server/ISettingsBase.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/server/ISettingsBase.d.ts @@ -11,6 +11,7 @@ export interface Config { FramerateLimit: FramerateLimit; GroupStatusInterval: number; KeepAliveInterval: number; + LobbyKeepAliveInterval: number; Mark502and504AsNonImportant: boolean; MemoryManagementSettings: MemoryManagementSettings; NVidiaHighlights: boolean; @@ -18,7 +19,10 @@ export interface Config { PingServerResultSendInterval: number; PingServersInterval: number; ReleaseProfiler: ReleaseProfiler; + RequestConfirmationTimeouts: number[]; + RequestsMadeThroughLobby: string[]; SecondCycleDelaySeconds: number; + ShouldEstablishLobbyConnection: boolean; TurnOffLogging: boolean; WeaponOverlapDistanceCulling: number; WebDiagnosticsEnabled: boolean; diff --git a/TypeScript/1LogToConsole/types/services/BotEquipmentFilterService.d.ts b/TypeScript/1LogToConsole/types/services/BotEquipmentFilterService.d.ts index 43e64b0..ef3b504 100644 --- a/TypeScript/1LogToConsole/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/1LogToConsole/types/services/BotEquipmentFilterService.d.ts @@ -24,6 +24,18 @@ export declare class BotEquipmentFilterService { * @param baseValues Values to update */ protected adjustChances(equipmentChanges: Record, baseValues: EquipmentChances | ModsChances): void; + /** + * Get equipment settings for bot + * @param botEquipmentRole equipment role to return + * @returns EquipmentFilters object + */ + getBotEquipmentSettings(botEquipmentRole: string): EquipmentFilters; + /** + * Get weapon sight whitelist for a specific bot type + * @param botEquipmentRole equipment role of bot to look up + * @returns Dictionary of weapon type and their whitelisted scope types + */ + getBotWeaponSightWhitelist(botEquipmentRole: string): Record; /** * 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 diff --git a/TypeScript/1LogToConsole/types/services/BotEquipmentModPoolService.d.ts b/TypeScript/1LogToConsole/types/services/BotEquipmentModPoolService.d.ts new file mode 100644 index 0000000..6724ad1 --- /dev/null +++ b/TypeScript/1LogToConsole/types/services/BotEquipmentModPoolService.d.ts @@ -0,0 +1,65 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Mods } from "../models/eft/common/tables/IBotType"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { VFS } from "../utils/VFS"; +/** Store a mapping between weapons, their slots and the items that fit those slots */ +export declare class BotEquipmentModPoolService { + protected logger: ILogger; + protected vfs: VFS; + protected itemHelper: ItemHelper; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + protected weaponModPool: Mods; + protected gearModPool: Mods; + protected weaponPoolGenerated: boolean; + protected armorPoolGenerated: boolean; + constructor(logger: ILogger, vfs: VFS, itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Store dictionary of mods for each item passed in + * @param items items to find related mods and store in modPool + */ + protected generatePool(items: ITemplateItem[], poolType: string): void; + /** + * Empty the mod pool + */ + resetPool(): void; + /** + * Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already) + * @param itemTpl item to look up + * @param slotName slot to get compatible mods for + * @returns tpls that fit the slot + */ + getCompatibleModsForWeaponSlot(itemTpl: string, slotName: string): string[]; + /** + * Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already) + * @param itemTpl item to look up + * @param slotName slot to get compatible mods for + * @returns tpls that fit the slot + */ + getCompatibleModsFoGearSlot(itemTpl: string, slotName: string): string[]; + /** + * Get mods for a piece of gear by its tpl + * @param itemTpl items tpl to look up mods for + * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value + */ + getModsFoGearSlot(itemTpl: string): Record; + /** + * Get mods for a weapon by its tpl + * @param itemTpl Weapons tpl to look up mods for + * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value + */ + getModsForWeaponSlot(itemTpl: string): Record; + /** + * Create weapon mod pool and set generated flag to true + */ + protected generateWeaponPool(): void; + /** + * Create gear mod pool and set generated flag to true + */ + protected generateGearPool(): void; +} diff --git a/TypeScript/1LogToConsole/types/services/BotWeaponModLimitService.d.ts b/TypeScript/1LogToConsole/types/services/BotWeaponModLimitService.d.ts new file mode 100644 index 0000000..f8ebc2f --- /dev/null +++ b/TypeScript/1LogToConsole/types/services/BotWeaponModLimitService.d.ts @@ -0,0 +1,54 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +export declare class BotModLimits { + scope: ItemCount; + scopeMax: number; + scopeBaseTypes: string[]; + flashlightLaser: ItemCount; + flashlightLaserMax: number; + flashlgihtLaserBaseTypes: string[]; +} +export declare class ItemCount { + count: number; +} +export declare class BotWeaponModLimitService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected itemHelper: ItemHelper; + protected botConfig: IBotConfig; + constructor(logger: ILogger, configServer: ConfigServer, itemHelper: ItemHelper); + /** + * Initalise mod limits to be used when generating a weapon + * @param botRole "assault", "bossTagilla" or "pmc" + * @returns BotModLimits object + */ + getWeaponModLimits(botRole: string): BotModLimits; + /** + * Check if weapon mod item is on limited list + has surpassed the limit set for it + * Exception: Always allow ncstar backup mount + * Exception: Always allow scopes with a scope for a parent + * Exception: Always disallow mounts that hold only scopes once scope limit reached + * Exception: Always disallow mounts that hold only flashlights once flashlight limit reached + * @param botRole role the bot has e.g. assault + * @param modTemplate mods template data + * @param modLimits limits set for weapon being generated for this bot + * @param modsParent The parent of the mod to be checked + * @returns true if over item limit + */ + weaponModHasReachedLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits, modsParent: ITemplateItem, weapon: Item[]): boolean; + /** + * Check if the specific item type on the weapon has reached the set limit + * @param modTpl log mod tpl if over type limit + * @param currentCount current number of this item on gun + * @param maxLimit mod limit allowed + * @param botRole role of bot we're checking weapon of + * @returns true if limit reached + */ + protected weaponModLimitReached(modTpl: string, currentCount: { + count: number; + }, maxLimit: number, botRole: string): boolean; +} diff --git a/TypeScript/1LogToConsole/types/services/ItemBaseClassService.d.ts b/TypeScript/1LogToConsole/types/services/ItemBaseClassService.d.ts index 7d816c4..3c60658 100644 --- a/TypeScript/1LogToConsole/types/services/ItemBaseClassService.d.ts +++ b/TypeScript/1LogToConsole/types/services/ItemBaseClassService.d.ts @@ -27,7 +27,7 @@ export declare class ItemBaseClassService { * @param baseClass base class to check for * @returns true if item inherits from base class passed in */ - itemHasBaseClass(itemTpl: string, baseClass: string): boolean; + itemHasBaseClass(itemTpl: string, baseClasses: string[]): boolean; /** * Get base classes item inherits from * @param itemTpl item to get base classes for diff --git a/TypeScript/1LogToConsole/types/services/LocaleService.d.ts b/TypeScript/1LogToConsole/types/services/LocaleService.d.ts index 8275b75..09c658b 100644 --- a/TypeScript/1LogToConsole/types/services/LocaleService.d.ts +++ b/TypeScript/1LogToConsole/types/services/LocaleService.d.ts @@ -1,5 +1,4 @@ import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; -import { ILocaleGlobalBase } from "../models/spt/server/ILocaleBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,9 +13,9 @@ export declare class LocaleService { constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** * Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' - * @returns ILocaleGlobalBase + * @returns dictionary */ - getLocaleDb(): ILocaleGlobalBase; + getLocaleDb(): Record; /** * Gets the game locale key from the locale.json file, * if value is 'system' get system locale diff --git a/TypeScript/1LogToConsole/types/services/SeasonalEventService.d.ts b/TypeScript/1LogToConsole/types/services/SeasonalEventService.d.ts new file mode 100644 index 0000000..80f5487 --- /dev/null +++ b/TypeScript/1LogToConsole/types/services/SeasonalEventService.d.ts @@ -0,0 +1,69 @@ +import { Config } from "../models/eft/common/IGlobals"; +import { Inventory } from "../models/eft/common/tables/IBotType"; +import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; +export declare class SeasonalEventService { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; + protected configServer: ConfigServer; + protected seasonalEventConfig: ISeasonalEventConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + protected get events(): Record; + get christmasEventItems(): string[]; + /** + * Get an array of christmas items found in bots inventories as loot + * @returns array + */ + getChristmasEventItems(): string[]; + itemIsChristmasRelated(itemId: string): boolean; + /** + * is christmas event active + * @returns true if active + */ + christmasEventEnabled(): boolean; + /** + * Is detection of seasonal events enabled (halloween / christmas) + * @returns true if seasonal events should be checked for + */ + isAutomaticEventDetectionEnabled(): boolean; + /** + * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween + * @param eventName Name of event to get gear changes for + * @returns bots with equipment changes + */ + protected getEventBotGear(eventName: string): Record>>; + /** + * Get the dates each seasonal event starts and ends + * @returns Record with event name + start/end date + */ + getEventDetails(): ISeasonalEvent[]; + /** + * Check if current date falls inside any of the seasons events pased in, if so, handle them + */ + checkForAndEnableSeasonalEvents(): void; + /** + * Iterate through bots inventory and loot to find and remove christmas items (as defined in SeasonalEventService) + * @param nodeInventory Bots inventory to iterate over + */ + removeChristmasItemsFromBotInventory(nodeInventory: Inventory): void; + /** + * Make adjusted to server code based on the name of the event passed in + * @param globalConfig globals.json + * @param eventName Name of the event to enable. e.g. Christmas + */ + protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + /** + * Read in data from seasonalEvents.json and add found equipment items to bots + * @param eventName Name of the event to read equipment in from config + */ + protected addEventGearToScavs(eventName: string): void; + protected addPumpkinsToScavBackpacks(): void; + /** + * Set Khorovod(dancing tree) chance to 100% on all maps that support it + */ + protected enableDancingTree(): void; +}