​Compatibility update for SPT-Aki v3.2.3

This commit is contained in:
VforValens 2022-09-11 21:55:55 -04:00
parent 3113e0615b
commit 37ef6a4439
35 changed files with 637 additions and 125 deletions

View File

@ -14,8 +14,6 @@ import { Logger } from "./logger";
// import { IPreAkiLoadMod } from "@spt-aki/models/external/IPreAkiLoadMod"; // import { IPreAkiLoadMod } from "@spt-aki/models/external/IPreAkiLoadMod";
import { Scavs } from "./scavs"; import { Scavs } from "./scavs";
import { PMCs } from "./pmc"; import { PMCs } from "./pmc";
import { BotGenerator } from "@spt-aki/generators/BotGenerator";
import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase";
class ValensProgression implements IPostDBLoadMod class ValensProgression implements IPostDBLoadMod

View File

@ -4,7 +4,7 @@ export declare class ContextVariable {
private timestamp; private timestamp;
private type; private type;
constructor(value: any, type: ContextVariableType); constructor(value: any, type: ContextVariableType);
getValue(): any; getValue<T>(): T;
getTimestamp(): Date; getTimestamp(): Date;
getType(): ContextVariableType; getType(): ContextVariableType;
} }

View File

@ -5,15 +5,21 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase";
import { IBotCore } from "../models/eft/common/tables/IBotCore"; import { IBotCore } from "../models/eft/common/tables/IBotCore";
import { Difficulty } from "../models/eft/common/tables/IBotType"; import { Difficulty } from "../models/eft/common/tables/IBotType";
import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IBotConfig } from "../models/spt/config/IBotConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { BotGenerationCacheService } from "../services/BotGenerationCacheService";
import { PmcAiService } from "../services/PmcAiService";
export declare class BotController { export declare class BotController {
protected logger: ILogger;
protected databaseServer: DatabaseServer; protected databaseServer: DatabaseServer;
protected botGenerator: BotGenerator; protected botGenerator: BotGenerator;
protected botHelper: BotHelper; protected botHelper: BotHelper;
protected pmcAiService: PmcAiService;
protected botGenerationCacheService: BotGenerationCacheService;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected botConfig: IBotConfig; protected botConfig: IBotConfig;
constructor(databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, configServer: ConfigServer); constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer);
/** /**
* Return the number of bot loadout varieties to be generated * Return the number of bot loadout varieties to be generated
* @param type bot Type we want the loadout gen count for * @param type bot Type we want the loadout gen count for
@ -29,7 +35,7 @@ export declare class BotController {
* @returns Difficulty object * @returns Difficulty object
*/ */
getBotDifficulty(type: string, difficulty: string): Difficulty; getBotDifficulty(type: string, difficulty: string): Difficulty;
protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string): Difficulty; protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty;
generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[];
getBotCap(): number; getBotCap(): number;
} }

View File

@ -15,8 +15,10 @@ import { IMatchConfig } from "../models/spt/config/IMatchConfig";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { BotGenerationCacheService } from "../services/BotGenerationCacheService";
import { BotLootCacheService } from "../services/BotLootCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService";
import { MatchLocationService } from "../services/MatchLocationService"; import { MatchLocationService } from "../services/MatchLocationService";
import { PmcAiService } from "../services/PmcAiService";
import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService";
export declare class MatchController { export declare class MatchController {
protected logger: ILogger; protected logger: ILogger;
@ -27,11 +29,13 @@ export declare class MatchController {
protected botLootCacheService: BotLootCacheService; protected botLootCacheService: BotLootCacheService;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected profileSnapshotService: ProfileSnapshotService; protected profileSnapshotService: ProfileSnapshotService;
protected pmcAiService: PmcAiService;
protected botGenerationCacheService: BotGenerationCacheService;
protected applicationContext: ApplicationContext; protected applicationContext: ApplicationContext;
protected matchConfig: IMatchConfig; protected matchConfig: IMatchConfig;
protected inraidConfig: IInRaidConfig; protected inraidConfig: IInRaidConfig;
protected botConfig: IBotConfig; protected botConfig: IBotConfig;
constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, applicationContext: ApplicationContext); constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext);
getEnabled(): boolean; getEnabled(): boolean;
getProfile(info: IGetProfileRequestData): IPmcData[]; getProfile(info: IGetProfileRequestData): IPmcData[];
createGroup(sessionID: string, info: ICreateGroupRequestData): any; createGroup(sessionID: string, info: ICreateGroupRequestData): any;

View File

@ -9,6 +9,7 @@ import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService";
import { PmcAiService } from "../services/PmcAiService";
import { HashUtil } from "../utils/HashUtil"; import { HashUtil } from "../utils/HashUtil";
import { JsonUtil } from "../utils/JsonUtil"; import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil"; import { RandomUtil } from "../utils/RandomUtil";
@ -30,9 +31,10 @@ export declare class BotGenerator {
protected botEquipmentFilterService: BotEquipmentFilterService; protected botEquipmentFilterService: BotEquipmentFilterService;
protected botHelper: BotHelper; protected botHelper: BotHelper;
protected gameEventHelper: GameEventHelper; protected gameEventHelper: GameEventHelper;
protected pmcAiService: PmcAiService;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected botConfig: IBotConfig; protected botConfig: IBotConfig;
constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, pmcAiService: PmcAiService, configServer: ConfigServer);
/** /**
* Generate a player scav bot object * Generate a player scav bot object
* @param role e.g. assault / pmcbot * @param role e.g. assault / pmcbot
@ -41,13 +43,13 @@ export declare class BotGenerator {
* @returns * @returns
*/ */
generatePlayerScav(sessionId: string, 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 * Generate an array of bot objects for populate a raid with
* @param botRole the bot role to check if should be a pmc * @param sessionId session id
* @returns true if should be a pmc * @param info request object
* @returns bot array
*/ */
protected shouldBotBePmc(botRole: string): boolean; generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[];
/** /**
* Get a randomised PMC side based on bot config value 'isUsec' * Get a randomised PMC side based on bot config value 'isUsec'
* @returns pmc side as string * @returns pmc side as string
@ -58,12 +60,30 @@ export declare class BotGenerator {
* @returns IBotBase object * @returns IBotBase object
*/ */
protected getCloneOfBotBase(): IBotBase; protected getCloneOfBotBase(): IBotBase;
/**
* Create a IBotBase object with equipment/loot/exp etc
* @param sessionId Session id
* @param bot bots base file
* @param role botRole bot will use
* @param node Bot template from db/bots/x.json
* @param isPmc Is bot to be a PMC
* @param isPlayerScav is bot to be a p scav bot
* @returns IBotBase object
*/
protected generateBot(sessionId: string, bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; 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 * Log the number of PMCs generated to the debug console
* @param output Generated bot array, ready to send to client
*/ */
protected logPmcGeneratedCount(output: IBotBase[]): void; protected logPmcGeneratedCount(output: IBotBase[]): void;
protected generateRandomLevel(min: number, max: number): BotGenerator.IRandomisedBotLevelResult; /**
* Return a randomised bot level and exp value
* @param role botRole being generated for
* @param min Min exp value
* @param max Max exp value
* @returns IRandomisedBotLevelResult object
*/
protected generateRandomLevel(role: string, min: number, max: number): BotGenerator.IRandomisedBotLevelResult;
/** /**
* Converts health object to the required format * Converts health object to the required format
* @param healthObj health object from bot json * @param healthObj health object from bot json
@ -72,19 +92,23 @@ export declare class BotGenerator {
*/ */
protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth;
protected generateSkills(skillsObj: Skills): Skills; protected generateSkills(skillsObj: Skills): Skills;
/**
* Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType)
* @param pmcSide eft side (usec/bear)
* @returns pmc side as defined in config
*/
protected getPmcRole(pmcSide: string): string;
/** /**
* Iterate through bots inventory and loot to find and remove christmas items (as defined in GameEventHelper) * Iterate through bots inventory and loot to find and remove christmas items (as defined in GameEventHelper)
* @param nodeInventory Bots inventory to iterate over * @param nodeInventory Bots inventory to iterate over
*/ */
protected removeChristmasItemsFromBotInventory(nodeInventory: Inventory): void; protected removeChristmasItemsFromBotInventory(nodeInventory: Inventory): void;
/**
* Generate a random Id for a bot and apply to bots _id and aid value
* @param bot bot to update
* @returns updated IBotBase object
*/
protected generateId(bot: IBotBase): IBotBase; protected generateId(bot: IBotBase): IBotBase;
protected generateInventoryID(profile: IBotBase): IBotBase; protected generateInventoryID(profile: IBotBase): IBotBase;
/**
* Get the difficulty passed in, if its not "asoline", get selected difficulty from config
* @param requestedDifficulty
* @returns
*/
protected getPMCDifficulty(requestedDifficulty: string): string; protected getPMCDifficulty(requestedDifficulty: string): string;
/** /**
* Add a side-specific (usec/bear) dogtag item to a bots inventory * Add a side-specific (usec/bear) dogtag item to a bots inventory

View File

@ -1,13 +1,16 @@
import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper";
import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper";
import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase";
import { Inventory, Chances, Generation, Mods } from "../models/eft/common/tables/IBotType"; import { Chances, Generation, Inventory, Mods } from "../models/eft/common/tables/IBotType";
import { EquipmentSlots } from "../models/enums/EquipmentSlots";
import { IBotConfig } from "../models/spt/config/IBotConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { HashUtil } from "../utils/HashUtil"; import { HashUtil } from "../utils/HashUtil";
import { RandomUtil } from "../utils/RandomUtil"; import { RandomUtil } from "../utils/RandomUtil";
import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper";
import { BotWeaponGenerator } from "./BotWeaponGenerator";
import { BotLootGenerator } from "./BotLootGenerator"; import { BotLootGenerator } from "./BotLootGenerator";
import { ILogger } from "../models/spt/utils/ILogger"; import { BotWeaponGenerator } from "./BotWeaponGenerator";
import { DatabaseServer } from "../servers/DatabaseServer";
import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper";
export declare class BotInventoryGenerator { export declare class BotInventoryGenerator {
protected logger: ILogger; protected logger: ILogger;
protected hashUtil: HashUtil; protected hashUtil: HashUtil;
@ -17,8 +20,14 @@ export declare class BotInventoryGenerator {
protected botLootGenerator: BotLootGenerator; protected botLootGenerator: BotLootGenerator;
protected botGeneratorHelper: BotGeneratorHelper; protected botGeneratorHelper: BotGeneratorHelper;
protected weightedRandomHelper: WeightedRandomHelper; protected weightedRandomHelper: WeightedRandomHelper;
constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper); protected configServer: ConfigServer;
generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, generation: Generation, botRole: string, isPmc: boolean): PmcInventory; protected botConfig: IBotConfig;
constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer);
generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory;
protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: {
slot: EquipmentSlots;
shouldSpawn: boolean;
}, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void;
protected generateEquipment(equipmentSlot: string, equipmentPool: Record<string, number>, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; protected generateEquipment(equipmentSlot: string, equipmentPool: Record<string, number>, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void;
protected generateInventoryBase(): PmcInventory; protected generateInventoryBase(): PmcInventory;
} }

View File

@ -1,4 +1,5 @@
import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper";
import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper";
import { HandbookHelper } from "../helpers/HandbookHelper"; import { HandbookHelper } from "../helpers/HandbookHelper";
import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase";
import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType";
@ -20,10 +21,11 @@ export declare class BotLootGenerator {
protected handbookHelper: HandbookHelper; protected handbookHelper: HandbookHelper;
protected botGeneratorHelper: BotGeneratorHelper; protected botGeneratorHelper: BotGeneratorHelper;
protected botWeaponGenerator: BotWeaponGenerator; protected botWeaponGenerator: BotWeaponGenerator;
protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper;
protected botLootCacheService: BotLootCacheService; protected botLootCacheService: BotLootCacheService;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected botConfig: IBotConfig; protected botConfig: IBotConfig;
constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botLootCacheService: BotLootCacheService, configServer: ConfigServer); constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer);
generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; 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; protected getRandomisedCount(min: number, max: number, nValue: number): number;
/** /**

View File

@ -1,4 +1,5 @@
import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper";
import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper";
import { ItemHelper } from "../helpers/ItemHelper"; import { ItemHelper } from "../helpers/ItemHelper";
import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper";
import { MinMax } from "../models/common/MinMax"; import { MinMax } from "../models/common/MinMax";
@ -14,6 +15,7 @@ import { DatabaseServer } from "../servers/DatabaseServer";
import { HashUtil } from "../utils/HashUtil"; import { HashUtil } from "../utils/HashUtil";
import { JsonUtil } from "../utils/JsonUtil"; import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil"; import { RandomUtil } from "../utils/RandomUtil";
import { IInventoryMagGen } from "./weapongen/IInventoryMagGen";
export declare class BotWeaponGenerator { export declare class BotWeaponGenerator {
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected logger: ILogger; protected logger: ILogger;
@ -24,9 +26,11 @@ export declare class BotWeaponGenerator {
protected botGeneratorHelper: BotGeneratorHelper; protected botGeneratorHelper: BotGeneratorHelper;
protected randomUtil: RandomUtil; protected randomUtil: RandomUtil;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper;
protected inventoryMagGenComponents: IInventoryMagGen[];
protected readonly modMagazineSlotId = "mod_magazine"; protected readonly modMagazineSlotId = "mod_magazine";
protected botConfig: IBotConfig; protected botConfig: IBotConfig;
constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer); constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, inventoryMagGenComponents: IInventoryMagGen[]);
/** /**
* Pick a random weapon based on weightings and generate a functional weapon * Pick a random weapon based on weightings and generate a functional weapon
* @param equipmentSlot Primary/secondary/holster * @param equipmentSlot Primary/secondary/holster
@ -67,7 +71,7 @@ export declare class BotWeaponGenerator {
* @param botRole for durability values * @param botRole for durability values
* @returns Base weapon item in array * @returns Base weapon item in array
*/ */
constructWeaponBaseArray(weaponTpl: string, weaponParentId: string, equipmentSlot: string, weaponItemTemplate: ITemplateItem, botRole: string): Item[]; protected constructWeaponBaseArray(weaponTpl: string, weaponParentId: string, equipmentSlot: string, weaponItemTemplate: ITemplateItem, botRole: string): Item[];
/** /**
* Get the mods necessary to kit out a weapon to its preset level * Get the mods necessary to kit out a weapon to its preset level
* @param weaponTpl weapon to find preset for * @param weaponTpl weapon to find preset for
@ -85,36 +89,12 @@ export declare class BotWeaponGenerator {
/** /**
* Generates extra magazines or bullets (if magazine is internal) and adds them to TacticalVest and Pockets. * Generates extra magazines or bullets (if magazine is internal) and adds them to TacticalVest and Pockets.
* Additionally, adds extra bullets to SecuredContainer * Additionally, adds extra bullets to SecuredContainer
* @param weaponMods mods to attach to weapon * @param generatedWeaponResult object with properties for generated weapon (weapon mods pool / weapon template / ammo tpl)
* @param weaponTemplate db template for weapon * @param magCounts Magazine count to add to inventory
* @param magCounts magazine count to add to inventory * @param inventory Inventory to add magazines to
* @param ammoTpl ammo templateId to add to magazines * @param botRole The bot type we're getting generating extra mags for
* @param inventory inventory to add magazines to
* @param botRole the bot type we're getting generating extra mags for
* @returns
*/ */
addExtraMagazinesToInventory(weaponMods: Item[], weaponTemplate: ITemplateItem, magCounts: MinMax, ammoTpl: string, inventory: PmcInventory, botRole: string): void; addExtraMagazinesToInventory(generatedWeaponResult: GenerateWeaponResult, magCounts: MinMax, 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
* @param magTemplate magazine to generate bullet count for
* @returns bullet count number
*/
protected getRandomisedBulletCount(magCounts: MinMax, magTemplate: ITemplateItem): number;
/**
* Get a randomised count of magazines
* @param magCounts min and max value returned value can be between
* @returns numberical value of magazine count
*/
protected getRandomisedMagazineCount(magCounts: MinMax): number;
/** /**
* Add ammo to the secure container * Add ammo to the secure container
* @param stackCount How many stacks of ammo to add * @param stackCount How many stacks of ammo to add
@ -131,13 +111,6 @@ export declare class BotWeaponGenerator {
* @returns magazine tpl string * @returns magazine tpl string
*/ */
protected getMagazineTplFromWeaponTemplate(weaponMods: Item[], weaponTemplate: ITemplateItem, botRole: string): string; protected getMagazineTplFromWeaponTemplate(weaponMods: Item[], weaponTemplate: ITemplateItem, botRole: string): string;
/**
* Get a weapons default magazine template id
* @param weaponTemplate weapon to get default magazine for
* @returns tpl of magazine
*/
protected getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string;
protected addBulletsToVestAndPockets(ammoTpl: string, bulletCount: number, inventory: PmcInventory): void;
/** /**
* Finds and return a compatible ammo tpl based on the bots ammo weightings (x.json/inventory/equipment/ammo) * 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 ammo a list of ammo tpls the weapon can use

View File

@ -6,14 +6,16 @@ import { LootRequest } from "../models/spt/services/LootRequest";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { ItemFilterService } from "../services/ItemFilterService"; import { ItemFilterService } from "../services/ItemFilterService";
import { HashUtil } from "../utils/HashUtil";
import { RandomUtil } from "../utils/RandomUtil"; import { RandomUtil } from "../utils/RandomUtil";
export declare class LootGenerator { export declare class LootGenerator {
protected logger: ILogger; protected logger: ILogger;
protected hashUtil: HashUtil;
protected databaseServer: DatabaseServer; protected databaseServer: DatabaseServer;
protected randomUtil: RandomUtil; protected randomUtil: RandomUtil;
protected itemHelper: ItemHelper; protected itemHelper: ItemHelper;
protected itemFilterService: ItemFilterService; protected itemFilterService: ItemFilterService;
constructor(logger: ILogger, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, itemFilterService: ItemFilterService); constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, itemFilterService: ItemFilterService);
/** /**
* Generate a list of items based on options passed in * Generate a list of items based on options passed in
* @param options parameters to adjust what loot is generated * @param options parameters to adjust what loot is generated
@ -39,7 +41,7 @@ export declare class LootGenerator {
protected findAndAddRandomItemToLoot(items: [string, ITemplateItem][], itemTypeCounts: Record<string, { protected findAndAddRandomItemToLoot(items: [string, ITemplateItem][], itemTypeCounts: Record<string, {
current: number; current: number;
max: number; max: number;
}>, result: LootItem[]): boolean; }>, whitelistedArmorLevels: number[], result: LootItem[]): boolean;
/** /**
* *
* Find a random item in items.json and add to result array * Find a random item in items.json and add to result array

View File

@ -1,5 +1,8 @@
import { ItemHelper } from "../helpers/ItemHelper"; import { ItemHelper } from "../helpers/ItemHelper";
import { Preset } from "../models/eft/common/IGlobals";
import { Item } from "../models/eft/common/tables/IItem"; import { Item } from "../models/eft/common/tables/IItem";
import { IRagfairConfig } from "../models/spt/config/IRagfairConfig";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { HashUtil } from "../utils/HashUtil"; import { HashUtil } from "../utils/HashUtil";
import { JsonUtil } from "../utils/JsonUtil"; import { JsonUtil } from "../utils/JsonUtil";
@ -8,18 +11,40 @@ export declare class RagfairAssortGenerator {
protected hashUtil: HashUtil; protected hashUtil: HashUtil;
protected itemHelper: ItemHelper; protected itemHelper: ItemHelper;
protected databaseServer: DatabaseServer; protected databaseServer: DatabaseServer;
protected configServer: ConfigServer;
protected generatedAssortItems: Item[]; protected generatedAssortItems: Item[];
constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer); protected ragfairConfig: IRagfairConfig;
constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer);
/** /**
* Get an array of unique items that can be sold on the flea * Get an array of unique items that can be sold on the flea
* @returns array of unique items * @returns array of unique items
*/ */
getAssortItems(): Item[]; getAssortItems(): Item[];
/**
* Check internal generatedAssortItems array has objects
* @returns true if array has objects
*/
protected assortsAreGenerated(): boolean; protected assortsAreGenerated(): boolean;
/** /**
* Generate an array of items the flea can sell * Generate an array of items the flea can sell
* @returns array of unique items * @returns array of unique items
*/ */
protected generateRagfairAssortItems(): Item[]; protected generateRagfairAssortItems(): Item[];
/**
* Get presets from globals.json
* @returns Preset object array
*/
protected getPresets(): Preset[];
/**
* Get default presets from globals.json
* @returns Preset object array
*/
protected getDefaultPresets(): Preset[];
/**
* Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true
* @param tplId tplid to add to item
* @param id id to add to item
* @returns hydrated Item object
*/
protected createRagfairAssortItem(tplId: string, id?: string): Item; protected createRagfairAssortItem(tplId: string, id?: string): Item;
} }

View File

@ -0,0 +1,6 @@
import { InventoryMagGen } from "./InventoryMagGen";
export interface IInventoryMagGen {
getPriority(): number;
canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean;
process(inventoryMagGen: InventoryMagGen): void;
}

View File

@ -0,0 +1,16 @@
import { MinMax } from "../../models/common/MinMax";
import { Inventory } from "../../models/eft/common/tables/IBotBase";
import { ITemplateItem } from "../../models/eft/common/tables/ITemplateItem";
export declare class InventoryMagGen {
private magCounts;
private magazineTemplate;
private weaponTemplate;
private ammoTemplate;
private pmcInventory;
constructor(magCounts: MinMax, magazineTemplate: ITemplateItem, weaponTemplate: ITemplateItem, ammoTemplate: ITemplateItem, pmcInventory: Inventory);
getMagCount(): MinMax;
getMagazineTemplate(): ITemplateItem;
getWeaponTemplate(): ITemplateItem;
getAmmoTemplate(): ITemplateItem;
getPmcInventory(): Inventory;
}

View File

@ -0,0 +1,12 @@
import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper";
import { RandomUtil } from "../../../utils/RandomUtil";
import { IInventoryMagGen } from "../IInventoryMagGen";
import { InventoryMagGen } from "../InventoryMagGen";
export declare class BarrelInventoryMagGen implements IInventoryMagGen {
protected randomUtil: RandomUtil;
protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper;
constructor(randomUtil: RandomUtil, botWeaponGeneratorHelper: BotWeaponGeneratorHelper);
getPriority(): number;
canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean;
process(inventoryMagGen: InventoryMagGen): void;
}

View File

@ -0,0 +1,14 @@
import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper";
import { ItemHelper } from "../../../helpers/ItemHelper";
import { ILogger } from "../../../models/spt/utils/ILogger";
import { IInventoryMagGen } from "../IInventoryMagGen";
import { InventoryMagGen } from "../InventoryMagGen";
export declare class ExternalInventoryMagGen implements IInventoryMagGen {
protected logger: ILogger;
protected itemHelper: ItemHelper;
protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper;
constructor(logger: ILogger, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper);
getPriority(): number;
canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean;
process(inventoryMagGen: InventoryMagGen): void;
}

View File

@ -0,0 +1,10 @@
import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper";
import { IInventoryMagGen } from "../IInventoryMagGen";
import { InventoryMagGen } from "../InventoryMagGen";
export declare class InternalMagazineInventoryMagGen implements IInventoryMagGen {
protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper;
constructor(botWeaponGeneratorHelper: BotWeaponGeneratorHelper);
getPriority(): number;
canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean;
process(inventoryMagGen: InventoryMagGen): void;
}

View File

@ -1,8 +1,7 @@
import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper"; import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper";
import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase";
import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; import { Mods, ModsChances } from "../models/eft/common/tables/IBotType";
import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem"; import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem";
import { Grid, ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem";
import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
@ -12,11 +11,23 @@ import { ItemFilterService } from "../services/ItemFilterService";
import { HashUtil } from "../utils/HashUtil"; import { HashUtil } from "../utils/HashUtil";
import { JsonUtil } from "../utils/JsonUtil"; import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil"; import { RandomUtil } from "../utils/RandomUtil";
import { BotWeaponGeneratorHelper } from "./BotWeaponGeneratorHelper";
import { ContainerHelper } from "./ContainerHelper"; import { ContainerHelper } from "./ContainerHelper";
import { InventoryHelper } from "./InventoryHelper"; import { InventoryHelper } from "./InventoryHelper";
import { ItemHelper } from "./ItemHelper"; import { ItemHelper } from "./ItemHelper";
import { ProbabilityHelper } from "./ProbabilityHelper"; import { ProbabilityHelper } from "./ProbabilityHelper";
import { ProfileHelper } from "./ProfileHelper"; 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 { export declare class BotGeneratorHelper {
protected logger: ILogger; protected logger: ILogger;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
@ -31,11 +42,11 @@ export declare class BotGeneratorHelper {
protected botEquipmentFilterService: BotEquipmentFilterService; protected botEquipmentFilterService: BotEquipmentFilterService;
protected itemFilterService: ItemFilterService; protected itemFilterService: ItemFilterService;
protected profileHelper: ProfileHelper; protected profileHelper: ProfileHelper;
protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected botConfig: IBotConfig; 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, configServer: ConfigServer); constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, configServer: ConfigServer);
/** /**
* TODO - very similar to generateModsForWeapon
* Check mods are compatible and add to array * Check mods are compatible and add to array
* @param equipment Equipment item to add mods to * @param equipment Equipment item to add mods to
* @param modPool Mod list to choose frm * @param modPool Mod list to choose frm
@ -46,18 +57,51 @@ export declare class BotGeneratorHelper {
*/ */
generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[];
/** /**
* TODO - very similar to generateModsForEquipment
* @param sessionId session id * @param sessionId session id
* @param weapon Weapon to add mods to * @param weapon Weapon to add mods to
* @param modPool pool of compatible mods to attach to gun * @param modPool Pool of compatible mods to attach to weapon
* @param weaponParentId parentId of weapon * @param weaponParentId parentId of weapon
* @param parentTemplate * @param parentWeaponTemplate Weapon which mods will be generated on
* @param modSpawnChances * @param modSpawnChances Mod spawn chances
* @param ammoTpl ammo tpl to use when generating magazines/cartridges * @param ammoTpl Ammo tpl to use when generating magazines/cartridges
* @param botRole role of bot weapon is generated for * @param botRole Role of bot weapon is generated for
* @returns Weapon with mods * @returns Weapon + mods array
*/ */
generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[];
/**
*
* @param modSlot
* @param isRandomisableSlot
* @param modsParent
* @param botEquipBlacklist
* @param itemModPool
* @param weapon array with only weapon tpl in it, ready for mods to be added
* @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine)
* @param parentTemplate
* @returns
*/
protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record<string, string[]>, 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] * 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 allowedMods Mods to be added to mod pool
@ -65,10 +109,24 @@ export declare class BotGeneratorHelper {
* @param modSlot Slot to generate mods for * @param modSlot Slot to generate mods for
* @param itemModPool base mod pool to replace values of * @param itemModPool base mod pool to replace values of
*/ */
protected generateDynamicModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record<string, string[]>): void; protected generateDynamicWeaponModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record<string, string[]>): void;
/**
* Find all compatible mods for equipment item and add to modPool
* @param itemDetails item to find mods for
* @param modPool ModPool to add mods to
*/
generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods): void;
/**
* Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist
* @param allowedMods base mods to filter
* @param botEquipBlacklist equipment blacklist
* @param modSlot slot mods belong to
* @returns Filtered array of mod tpls
*/
protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[];
/** /**
* Check if the specific item type on the weapon has reached the set limit * Check if the specific item type on the weapon has reached the set limit
* @param modTpl item to check is limited * @param modTpl log mod tpl if over type limit
* @param currentCount current number of this item on gun * @param currentCount current number of this item on gun
* @param maxLimit mod limit allowed * @param maxLimit mod limit allowed
* @param botRole role of bot we're checking weapon of * @param botRole role of bot we're checking weapon of
@ -78,16 +136,14 @@ export declare class BotGeneratorHelper {
count: number; count: number;
}, maxLimit: number, botRole: string): boolean; }, maxLimit: number, botRole: string): boolean;
/** /**
* log errors if mod is not valid for a slot * Log errors if mod is not compatible with slot
* @param modTpl * @param modToAdd template of mod to check
* @param found * @param itemSlot slot the item will be placed in
* @param itemSlot * @param modSlot slot the mod will fill
* @param modTemplate * @param parentTemplate tempalte of the mods parent item
* @param modSlot
* @param parentTemplate
* @returns true if valid * @returns true if valid
*/ */
protected isModValidForSlot(modTpl: string, found: boolean, itemSlot: Slot, modTemplate: ITemplateItem, modSlot: string, parentTemplate: ITemplateItem): boolean; protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean;
/** /**
* Create a mod item with parameters as properties * Create a mod item with parameters as properties
* @param modId _id * @param modId _id
@ -98,12 +154,6 @@ export declare class BotGeneratorHelper {
* @returns Item object * @returns Item object
*/ */
protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem): Item; 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
* @returns true if it is cylinder related
*/
magazineIsCylinderRelated(magazineParentName: string): boolean;
/** /**
* randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo 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 * never return true for an item that has 0% spawn chance
@ -115,7 +165,7 @@ export declare class BotGeneratorHelper {
protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean;
/** /**
* Get a list of containers that hold ammo * Get a list of containers that hold ammo
* e.g. mod_magazine * e.g. mod_magazine / patron_in_weapon_000
* @returns string array * @returns string array
*/ */
protected getAmmoContainers(): string[]; protected getAmmoContainers(): string[];
@ -168,6 +218,14 @@ export declare class BotGeneratorHelper {
* @returns Repairable object * @returns Repairable object
*/ */
protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable;
/**
* Get a random mod from an items compatible mods Filter array
* @param modTpl
* @param parentSlot
* @param modSlot
* @param items
* @returns item tpl
*/
protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string;
/** /**
* Can an item be added to an item without issue * Can an item be added to an item without issue
@ -177,23 +235,6 @@ export declare class BotGeneratorHelper {
* @returns true if possible * @returns true if possible
*/ */
isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean;
/**
* Adds an item with all its childern into specified equipmentSlots, wherever it fits.
* @param equipmentSlots
* @param parentId
* @param parentTpl
* @param itemWithChildren
* @param inventory
* @returns a `boolean` indicating item was added
*/
addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: PmcInventory): boolean;
/**
* 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 */ /** TODO - move into own class */
export declare class ExhaustableArray<T> { export declare class ExhaustableArray<T> {

View File

@ -13,11 +13,34 @@ export declare class BotHelper {
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected botConfig: IBotConfig; protected botConfig: IBotConfig;
constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, configServer: ConfigServer); constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, configServer: ConfigServer);
/**
* Get difficulty settings for desired bot type, if not found use assault bot types
* @param type bot type to retreive difficulty of
* @param difficulty difficulty to get settings for (easy/normal etc)
* @returns Difficulty object
*/
getBotDifficultySettings(type: string, difficulty: string): Difficulty; getBotDifficultySettings(type: string, difficulty: string): Difficulty;
/**
* Get a template object for the specified botRole from bots.types db
* @param role botRole to get template for
* @returns IBotType object
*/
getBotTemplate(role: string): IBotType; getBotTemplate(role: string): IBotType;
/**
* Get difficulty settings for a PMC
* @param type "usec" / "bear"
* @param difficulty what difficulty to retrieve
* @returns Difficulty object
*/
getPmcDifficultySettings(type: string, difficulty: string): Difficulty; getPmcDifficultySettings(type: string, difficulty: string): Difficulty;
/**
* Choose a random difficulty from - easy/normal/hard/impossible
* @returns random difficulty
*/
chooseRandomDifficulty(): string;
/** /**
* Randomise the chance the PMC will attack their own side * Randomise the chance the PMC will attack their own side
* Look up value in bot.json/chanceSameSideIsHostilePercent
* @param difficultySettings pmc difficulty settings * @param difficultySettings pmc difficulty settings
*/ */
randomisePmcHostility(difficultySettings: Difficulty): void; randomisePmcHostility(difficultySettings: Difficulty): void;
@ -31,7 +54,7 @@ export declare class BotHelper {
*/ */
addBotToFriendlyList(difficultySettings: Difficulty, typeToAdd: string): void; addBotToFriendlyList(difficultySettings: Difficulty, typeToAdd: string): void;
/** /**
* Add a bot to the ENEMY_BOT_TYPES array * Add a bot to the ENEMY_BOT_TYPES array, do not add itself if its on the enemy list
* @param difficultySettings bot settings to alter * @param difficultySettings bot settings to alter
* @param typesToAdd bot type to add to enemy list * @param typesToAdd bot type to add to enemy list
*/ */
@ -42,4 +65,10 @@ export declare class BotHelper {
* @param typesToAdd bot type to add to revenge list * @param typesToAdd bot type to add to revenge list
*/ */
addBotToRevengeList(difficultySettings: Difficulty, typesToAdd: string[]): void; addBotToRevengeList(difficultySettings: Difficulty, typesToAdd: string[]): void;
/**
* Choose if a bot should become a PMC by checking if bot type is allowed to become a Pmc in botConfig.convertFromChances and doing a random int check
* @param botRole the bot role to check if should be a pmc
* @returns true if should be a pmc
*/
shouldBotBePmc(botRole: string): boolean;
} }

View File

@ -0,0 +1,78 @@
import { MinMax } from "../models/common/MinMax";
import { Inventory } from "../models/eft/common/tables/IBotBase";
import { Item } from "../models/eft/common/tables/IItem";
import { Grid, ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer";
import { HashUtil } from "../utils/HashUtil";
import { RandomUtil } from "../utils/RandomUtil";
import { ContainerHelper } from "./ContainerHelper";
import { InventoryHelper } from "./InventoryHelper";
import { ItemHelper } from "./ItemHelper";
export declare class BotWeaponGeneratorHelper {
protected logger: ILogger;
protected databaseServer: DatabaseServer;
protected itemHelper: ItemHelper;
protected randomUtil: RandomUtil;
protected hashUtil: HashUtil;
protected inventoryHelper: InventoryHelper;
protected containerHelper: ContainerHelper;
constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper);
/**
* Get a randomised number of bullets for a specific magazine
* @param magCounts min and max count of magazines
* @param magTemplate magazine to generate bullet count for
* @returns bullet count number
*/
getRandomisedBulletCount(magCounts: MinMax, magTemplate: ITemplateItem): number;
/**
* Get a randomised count of magazines
* @param magCounts min and max value returned value can be between
* @returns numberical value of magazine count
*/
getRandomisedMagazineCount(magCounts: MinMax): number;
/**
* Is this magazine cylinder related (revolvers and grenade launchers)
* @param magazineParentName the name of the magazines parent
* @returns true if it is cylinder related
*/
magazineIsCylinderRelated(magazineParentName: string): boolean;
/**
* Create a magazine using the parameters given
* @param magazineTpl Tpl of the magazine to create
* @param ammoTpl Ammo to add to magazine
* @param magTemplate template object of magazine
* @returns Item array
*/
createMagazine(magazineTpl: string, ammoTpl: string, magTemplate: ITemplateItem): Item[];
/**
* Add a specific number of cartrdiges to a bots inventory (vest/pocket)
* @param ammoTpl Ammo tpl to add to vest/pockets
* @param cartridgeCount number of cartridges to add to vest/pockets
* @param inventory bot inventory to add cartridges to
*/
addBulletsToVestAndPockets(ammoTpl: string, cartridgeCount: number, inventory: Inventory): void;
/**
* Get a weapons default magazine template id
* @param weaponTemplate weapon to get default magazine for
* @returns tpl of magazine
*/
getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string;
/**
* Adds an item with all its childern into specified equipmentSlots, wherever it fits.
* @param equipmentSlots
* @param parentId
* @param parentTpl
* @param itemWithChildren
* @param inventory
* @returns a `boolean` indicating item was added
*/
addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): boolean;
/**
* is the provided item allowed inside a container
* @param slot location item wants to be placed in
* @param itemTpl item being placed
* @returns true if allowed
*/
protected itemAllowedInContainer(slot: Grid, itemTpl: string): boolean;
}

View File

@ -20,7 +20,7 @@ declare class ItemHelper {
protected databaseServer: DatabaseServer; protected databaseServer: DatabaseServer;
constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer); constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer);
/** /**
* Checks if a id is a valid item. Valid meaning that it's an item that be stored in stash * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash
* @param {string} tpl the template id / tpl * @param {string} tpl the template id / tpl
* @returns boolean; true for items that may be in player posession and not quest items * @returns boolean; true for items that may be in player posession and not quest items
*/ */
@ -79,6 +79,11 @@ declare class ItemHelper {
* @returns {array} The array of StackSlotItems * @returns {array} The array of StackSlotItems
*/ */
generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[];
/**
* Get cloned copy of all item data from items.json
* @returns array of ITemplateItem objects
*/
getItems(): ITemplateItem[];
/** /**
* Gets item data from items.json * Gets item data from items.json
* @param tpl items template id to look up * @param tpl items template id to look up

View File

@ -28,6 +28,8 @@ export interface IBotBase {
CarExtractCounts: CarExtractCounts; CarExtractCounts: CarExtractCounts;
SurvivorClass: SurvivorClass; SurvivorClass: SurvivorClass;
WishList: string[]; WishList: string[];
/** SPT specific property used during bot generation in raid */
sptIsPmc?: boolean;
} }
export interface Info { export interface Info {
EntryPoint: string; EntryPoint: string;

View File

@ -80,7 +80,7 @@ export interface Props {
HasShoulderContact?: boolean; HasShoulderContact?: boolean;
SightingRange?: number; SightingRange?: number;
DoubleActionAccuracyPenaltyMult?: number; DoubleActionAccuracyPenaltyMult?: number;
ModesCount: any; ModesCount?: any;
DurabilityBurnModificator?: number; DurabilityBurnModificator?: number;
HeatFactor?: number; HeatFactor?: number;
CoolFactor?: number; CoolFactor?: number;
@ -156,7 +156,7 @@ export interface Props {
RigLayoutName?: string; RigLayoutName?: string;
MaxDurability?: number; MaxDurability?: number;
armorZone?: string[]; armorZone?: string[];
armorClass: any; armorClass?: any;
mousePenalty?: number; mousePenalty?: number;
weaponErgonomicPenalty?: number; weaponErgonomicPenalty?: number;
BluntThroughput?: number; BluntThroughput?: number;
@ -254,8 +254,8 @@ export interface Props {
foodUseTime?: number; foodUseTime?: number;
foodEffectType?: string; foodEffectType?: string;
StimulatorBuffs?: string; StimulatorBuffs?: string;
effects_health: any; effects_health?: any;
effects_damage: any; effects_damage?: any;
MaximumNumberOfUsage?: number; MaximumNumberOfUsage?: number;
knifeHitDelay?: number; knifeHitDelay?: number;
knifeHitSlashRate?: number; knifeHitSlashRate?: number;

View File

@ -25,6 +25,7 @@ export declare enum BaseClasses {
SIGHTS = "5448fe7a4bdc2d6f028b456b", SIGHTS = "5448fe7a4bdc2d6f028b456b",
MEDS = "543be5664bdc2dd4348b4569", MEDS = "543be5664bdc2dd4348b4569",
MONEY = "543be5dd4bdc2deb348b4569", MONEY = "543be5dd4bdc2deb348b4569",
NIGHTVISION = "5a2c3a9486f774688b05e574",
KEY = "543be5e94bdc2df1348b4568", KEY = "543be5e94bdc2df1348b4568",
KEY_MECHANICAL = "5c99f98d86f7745c314214b3", KEY_MECHANICAL = "5c99f98d86f7745c314214b3",
KEYCARD = "5c164d2286f774194c5e69fa", KEYCARD = "5c164d2286f774194c5e69fa",
@ -66,7 +67,6 @@ export declare enum BaseClasses {
LUBRICANT = "57864e4c24597754843f8723", LUBRICANT = "57864e4c24597754843f8723",
BATTERY = "57864ee62459775490116fc1", BATTERY = "57864ee62459775490116fc1",
ASSAULT_SCOPE = "55818add4bdc2d5b648b456f", ASSAULT_SCOPE = "55818add4bdc2d5b648b456f",
REFLEX_SIGHT = "55818ad54bdc2ddc698b4569",
TACTICAL_COMBO = "55818b164bdc2ddc698b456c", TACTICAL_COMBO = "55818b164bdc2ddc698b456c",
FLASHLIGHT = "55818b084bdc2d5b648b4571", FLASHLIGHT = "55818b084bdc2d5b648b4571",
MAGAZINE = "5448bc234bdc2d3c308b4569", MAGAZINE = "5448bc234bdc2d3c308b4569",

151
types/models/enums/WeaponTypes.d.ts vendored Normal file
View File

@ -0,0 +1,151 @@
export declare enum Weapons127x55 {
ASH_12 = "5cadfbf7ae92152ac412eeef"
}
export declare enum Weapons86x70 {
MK_18 = "5fc22d7c187fea44d52eda44",
AXMC = "627e14b21713922ded6f2c15"
}
export declare enum Weapons9x39 {
AS_VAL = "57c44b372459772d2b39b8ce",
VSS_VINTOREZ = "57838ad32459774a17445cd2"
}
export declare enum Weapons762x54R {
SVDS = "5c46fbd72e2216398b5a8c9c",
MP_18 = "61f7c9e189e6fb1a5e3ea78d",
MOSIN_INFANTRY = "5bfd297f0db834001a669119",
MOSIN_SNIPER = "5ae08f0a5acfc408fb1398a1",
SV_98 = "55801eed4bdc2d89578b4588"
}
export declare enum Weapons762x51 {
VPO_101 = "5c501a4d2e221602b412b540",
DT_MDR_762 = "5dcbd56fdbd3d91b3e5468d5",
SA_58 = "5b0bbe4e5acfc40dc528a72d",
SCARH_BLACK = "6183afd850224f204c1da514",
SCARH_FDE = "6165ac306ef05c2ce828ef74",
HK_G28 = "6176aca650224f204c1da3fb",
M1A = "5aafa857e5b5b00018480968",
RFB = "5f2a9575926fd9352339381f",
RSASS = "5a367e5dc4a282000e49738f",
SR_25 = "5df8ce05b11454561e39243b",
DVL_10 = "588892092459774ac91d4b11",
M700 = "5bfea6e90db834001b7347f3",
T5000M = "5df24cf80dee1b22f862e9bc"
}
export declare enum Weapons366TKM {
VPO_209 = "59e6687d86f77411d949b251",
VPO_215 = "5de652c31b7e3716273428be"
}
export declare enum Weapons762x39 {
OP_SKS = "587e02ff24597743df3deaeb",
SKS = "574d967124597745970e7c94",
AK_103 = "5ac66d2e5acfc43b321d4b53",
AK_104 = "5ac66d725acfc43b321d4b60",
AKM = "59d6088586f774275f37482f",
AKMN = "5a0ec13bfcdbcb00165aa685",
AKMS = "59ff346386f77477562ff5e2",
AKMSN = "5abcbc27d8ce8700182eceeb",
MK47_MUTANT = "606587252535c57a13424cfd",
RD_704 = "628a60ae6b1d481ff772e9c8",
VPO_136 = "59e6152586f77473dc057aa1"
}
export declare enum Weapons762x35 {
MCX = "5fbcc1d9016cce60e8341ab3"
}
export declare enum Weapons556x45 {
ADAR_2_15 = "5c07c60e0db834002330051f",
AK_101 = "5ac66cb05acfc40198510a10",
AK_102 = "5ac66d015acfc400180ae6e4",
DT_MDR_556 = "5c488a752e221602b412af63",
HK_416A5 = "5bb2475ed4351e00853264e3",
HK_G36 = "623063e994fc3f7b302a9696",
M4A1 = "5447a9cd4bdc2dbd208b4567",
SCARL_BLACK = "6184055050224f204c1da540",
SCARL_FDE = "618428466ef05c2ce828f218",
TX15_DML = "5d43021ca4b9362eab4b5e25"
}
export declare enum Weapons545x39 {
AK_105 = "5ac66d9b5acfc4001633997a",
AK_74 = "5bf3e03b0db834001d2c4a9c",
AK_74M = "5ac4cd105acfc40016339859",
AK_74N = "5644bd2b4bdc2d3b4c8b4572",
AKS_74 = "5bf3e0490db83400196199af",
AKS_74N = "5ab8e9fcd8ce870019439434",
AKS_74U = "57dc2fa62459775949412633",
AKS_74UB = "5839a40f24597726f856b511",
AKS_74UN = "583990e32459771419544dd2",
SAG_AK = "628b5638ad252a16da6dd245",
SAG_AK_SHORT = "628b9c37a733087d0d7fe84b",
RPK_16 = "5beed0f50db834001c062b12"
}
export declare enum Weapons57x28FN {
FN_57_BLACK = "5d3eb3b0a4b93615055e84d2",
FN_57_FDE = "5d67abc1a4b93614ec50137f",
FN_P90 = "5cc82d76e24e8d00134b4b83"
}
export declare enum Weapons46x30HK {
MP7A1 = "5ba26383d4351e00334c93d9",
MP7A2 = "5bd70322209c4d00d7167b8f"
}
export declare enum Weapons1143x23 {
M1911A1 = "5e81c3cbac2bb513793cdc75",
M45A1 = "5f36a0e5fbf956000b716b65",
USP45 = "6193a720f8ee7e52e42109ed",
UMP45 = "5fc3e272f8b6a877a729eac5",
VECTOR45 = "5fb64bc92b1b027b1f50bcf2"
}
export declare enum Weapons9x33R {
CR_50DS = "61a4c8884f95bc3b2c5dc96f"
}
export declare enum Weapons9x21 {
SR_1MP = "59f98b4986f7746f546d2cef"
}
export declare enum Weapons9x19 {
GLOCK_17 = "5a7ae0c351dfba0017554310",
GLOCK_18C = "5b1fa9b25acfc40018633c01",
M9A3 = "5cadc190ae921500103bb3b6",
MP_443 = "576a581d2459771e7b1bc4f1",
P226R = "56d59856d2720bd8418b456a",
PL_15 = "602a9740da11d6478d5a06dc",
CR_200DS = "624c2e8614da335f1e034d8c",
MP5 = "5926bb2186f7744b1c6c6e60",
MP5K = "5d2f0d8048f0356c925bc3b0",
MP9 = "5e00903ae9dc277128008b87",
MP9_N = "5de7bd7bfd6b4e6e2276dc25",
MPX = "58948c8e86f77409493f7266",
PP_19_01 = "59984ab886f7743e98271174",
SAIGA_9 = "59f9cabd86f7743a10721f46",
STM_9 = "60339954d62c9b14ed777c06",
VECTOR_9MM = "5fc3f2d5900b1d5091531e57"
}
export declare enum Weapons9x18 {
APB = "5abccb7dd8ce87001773e277",
APS = "5a17f98cfcdbcb0980087290",
PB_SILENCED = "56e0598dd2720bb5668b45a6",
PM = "5448bd6b4bdc2dfc2f8b4569",
PM_T = "579204f224597773d619e051",
PP9_KLIN = "57f4c844245977379d5c14d1",
PP91_KEDR = "57d14d2524597714373db789",
PP91_KEDRB = "57f3c6bd24597738e730fa2f"
}
export declare enum Weapons762x25 {
TT = "571a12c42459771f627b58a0",
TT_GOLD = "5b3b713c5acfc4330140bd8d",
PPSH_41 = "5ea03f7400685063ec28bfa8"
}
export declare enum Weapons12Gauge {
M3_SUPER90 = "6259b864ebedf17603599e88",
M590A1 = "5e870397991fd70db46995c8",
M870 = "5a7828548dc32e5a9c28b516",
MP_133 = "54491c4f4bdc2db1078b4568",
MP_153 = "56dee2bdd2720bc8328b4567",
MP_155 = "606dae0ab0e443224b421bb7",
MP_43_1C = "5580223e4bdc2d1c128b457f",
MTS_255_12 = "60db29ce99594040e04c4a27",
SAIGA_12GA = "576165642459773c7a400233"
}
export declare enum Weapons20Gauge {
TOZ_106 = "5a38e6bac4a2826c6e06d79b"
}
export declare enum Weapons23x75 {
KS_23M = "5e848cc2988a8701445df1e8"
}

View File

@ -25,4 +25,5 @@ export interface AirdropLoot {
itemTypeWhitelist: string[]; itemTypeWhitelist: string[];
/** key: item base type: value: max count */ /** key: item base type: value: max count */
itemLimits: Record<string, number>; itemLimits: Record<string, number>;
armorLevelWhitelist: number[];
} }

View File

@ -65,6 +65,7 @@ export interface LootNvalue {
export interface EquipmentFilters { export interface EquipmentFilters {
weaponModLimits: ModLimits; weaponModLimits: ModLimits;
randomisedWeaponModSlots?: string[]; randomisedWeaponModSlots?: string[];
randomisedArmorSlots?: string[];
blacklist: EquipmentFilterDetails[]; blacklist: EquipmentFilterDetails[];
whitelist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[];
} }

View File

@ -7,14 +7,18 @@ export interface IPmcConfig {
looseWeaponInBackpackLootMinMax: MinMax; looseWeaponInBackpackLootMinMax: MinMax;
isUsec: number; isUsec: number;
chanceSameSideIsHostilePercent: number; chanceSameSideIsHostilePercent: number;
usecType: string; /** key: location, value: type for usec/bear */
bearType: string; pmcType: Record<string, PmcTypes>;
maxBackpackLootTotalRub: number; maxBackpackLootTotalRub: number;
maxPocketLootTotalRub: number; maxPocketLootTotalRub: number;
maxVestLootTotalRub: number; maxVestLootTotalRub: number;
convertIntoPmcChance: Record<string, MinMax>; convertIntoPmcChance: Record<string, MinMax>;
enemyTypes: string[]; enemyTypes: string[];
} }
export interface PmcTypes {
usec: string;
bear: string;
}
export interface DynamicLoot { export interface DynamicLoot {
whitelist: string[]; whitelist: string[];
blacklist: string[]; blacklist: string[];

View File

@ -39,6 +39,7 @@ export interface Dynamic {
offerItemCount: MinMax; offerItemCount: MinMax;
price: MinMax; price: MinMax;
presetPrice: MinMax; presetPrice: MinMax;
showDefaultPresetsOnly: boolean;
endTimeSeconds: MinMax; endTimeSeconds: MinMax;
condition: Condition; condition: Condition;
stackablePercent: MinMax; stackablePercent: MinMax;

View File

@ -1,4 +1,5 @@
export declare class LootItem { export declare class LootItem {
id?: string;
tpl: string; tpl: string;
isPreset: boolean; isPreset: boolean;
stackCount: number; stackCount: number;

View File

@ -6,4 +6,5 @@ export declare class LootRequest {
itemTypeWhitelist: string[]; itemTypeWhitelist: string[];
/** key: item base type: value: max count */ /** key: item base type: value: max count */
itemLimits: Record<string, number>; itemLimits: Record<string, number>;
armorLevelWhitelist: number[];
} }

View File

@ -0,0 +1,47 @@
import { BotHelper } from "../helpers/BotHelper";
import { IBotBase } from "../models/eft/common/tables/IBotBase";
import { ILogger } from "../models/spt/utils/ILogger";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil";
export declare class BotGenerationCacheService {
protected logger: ILogger;
protected randomUtil: RandomUtil;
protected jsonUtil: JsonUtil;
protected botHelper: BotHelper;
protected storedBots: IBotBase[];
constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper);
/**
* Store array of bots in cache, shuffle results before storage
* @param botsToStore
*/
storeBots(botsToStore: IBotBase[]): void;
/**
* Find and return a bot based on its role
* Remove bot from internal array so it can't be retreived again
* @param role role to retreive (assault/bossTagilla etc)
* @returns IBotBase object
*/
getBot(role: string): IBotBase[];
/**
* Find a bot by its index from cache
* @param indexOfBotToReturn index to find bot by
* @returns bot profile
*/
protected getBotFromCache(indexOfBotToReturn: number): IBotBase;
/**
* Remove bot profile by index from cache
* @param indexOfBotToReturn Index of bot profile to remove
*/
protected removeBotFromCache(indexOfBotToReturn: number): void;
/**
* Get index of bot profile that matches criteria
* @param role role of bot we want
* @param getPmc is requested bot a pmc
* @returns index of found bot
*/
protected getIndexOfBotToReturn(role: string, getPmc: boolean): number;
/**
* Remove all cached bot profiles
*/
clearStoredBots(): void;
}

View File

@ -34,6 +34,17 @@ export declare class BotLootCacheService {
* @param isPmc Is the bot a PMC (alteres what loot is cached) * @param isPmc Is the bot a PMC (alteres what loot is cached)
*/ */
protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void;
/**
* Sort a pool of item objects by its flea price
* @param poolToSort pool of items to sort
*/
protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void;
/**
* Add unique items into combined pool
* @param combinedItemPool Pool of items to add to
* @param itemsToAdd items to add to combined pool if unique
*/
protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void;
/** /**
* Ammo/grenades have this property * Ammo/grenades have this property
* @param props * @param props

View File

@ -55,6 +55,17 @@ export declare class FenceService {
* Replace a percentage of fence assorts with freshly generated items * Replace a percentage of fence assorts with freshly generated items
*/ */
performPartialRefresh(): void; performPartialRefresh(): void;
/**
* Increment fence next refresh timestamp by current timestamp + partialRefreshTimeSeconds from config
*/
protected incrementPartialRefreshTime(): void;
/**
* Compare the current fence offer count to what the config wants it to be,
* If value is lower add extra count to value to generate more items to fill gap
* @param existingItemCountToReplace count of items to generate
* @returns number of items to generate
*/
protected getCountOfItemsToGenerate(existingItemCountToReplace: number): number;
/** /**
* Choose an item (not mod) at random and remove from assorts * Choose an item (not mod) at random and remove from assorts
*/ */

27
types/services/PmcAiService.d.ts vendored Normal file
View File

@ -0,0 +1,27 @@
import { IBotConfig } from "../models/spt/config/IBotConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
/** Storing/retreving pmcRoles set at the start of a raid - its done at that point as we know what location the player is heading to */
export declare class PmcAiService {
protected logger: ILogger;
protected configServer: ConfigServer;
protected botConfig: IBotConfig;
protected usecRole: string;
protected bearRole: string;
constructor(logger: ILogger, configServer: ConfigServer);
/**
* Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType)
* @param pmcSide eft side (usec/bear)
* @returns pmc side as defined in config
*/
getPmcRole(pmcSide: "usec" | "bear" | string): string;
/**
* Set the roles for pmcs
* @param location map location to look up and use as pmc types
*/
setPmcRolesByLocation(location: string): void;
/**
* Clear the saved role from usec/bear PMCs
*/
clearPmcRoles(): void;
}

View File

@ -136,7 +136,7 @@ export declare class RandomUtil {
* Drawing can be with or without replacement * Drawing can be with or without replacement
* @param {array} list The array we want to draw randomly from * @param {array} list The array we want to draw randomly from
* @param {integer} count The number of times we want to draw * @param {integer} count The number of times we want to draw
* @param {boolean} replacement Draw with ot without replacement from the input array * @param {boolean} replacement Draw with or without replacement from the input array
* @return {array} Array consisting of N random elements * @return {array} Array consisting of N random elements
*/ */
drawRandomFromList<T>(list: Array<T>, count?: number, replacement?: boolean): Array<T>; drawRandomFromList<T>(list: Array<T>, count?: number, replacement?: boolean): Array<T>;