Merge branch 'master' into master

This commit is contained in:
Dinkadactyl 2022-09-08 17:32:40 +00:00
commit c849f9e51b
336 changed files with 6230 additions and 546 deletions

View File

@ -4,7 +4,7 @@ export declare class ContextVariable {
private timestamp;
private type;
constructor(value: any, type: ContextVariableType);
getValue(): any;
getValue<T>(): T;
getTimestamp(): Date;
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 { Difficulty } from "../models/eft/common/tables/IBotType";
import { IBotConfig } from "../models/spt/config/IBotConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { BotGenerationCacheService } from "../services/BotGenerationCacheService";
import { PmcAiService } from "../services/PmcAiService";
export declare class BotController {
protected logger: ILogger;
protected databaseServer: DatabaseServer;
protected botGenerator: BotGenerator;
protected botHelper: BotHelper;
protected pmcAiService: PmcAiService;
protected botGenerationCacheService: BotGenerationCacheService;
protected configServer: ConfigServer;
protected 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
* @param type bot Type we want the loadout gen count for
@ -29,7 +35,7 @@ export declare class BotController {
* @returns Difficulty object
*/
getBotDifficulty(type: string, difficulty: string): Difficulty;
protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string): Difficulty;
protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty;
generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[];
getBotCap(): number;
}

View File

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

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

View File

@ -67,7 +67,7 @@ export declare class BotWeaponGenerator {
* @param botRole for durability values
* @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
* @param weaponTpl weapon to find preset for

View File

@ -6,14 +6,16 @@ import { LootRequest } from "../models/spt/services/LootRequest";
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer";
import { ItemFilterService } from "../services/ItemFilterService";
import { HashUtil } from "../utils/HashUtil";
import { RandomUtil } from "../utils/RandomUtil";
export declare class LootGenerator {
protected logger: ILogger;
protected hashUtil: HashUtil;
protected databaseServer: DatabaseServer;
protected randomUtil: RandomUtil;
protected itemHelper: ItemHelper;
protected itemFilterService: ItemFilterService;
constructor(logger: ILogger, 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
* @param options parameters to adjust what loot is generated

View File

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

View File

@ -17,6 +17,17 @@ 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;
@ -58,6 +69,27 @@ export declare class BotGeneratorHelper {
* @returns Weapon with mods
*/
generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[];
/**
* 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 modTpl mods tpl
* @param modLimits limits set for weapon being generated for this bot
* @returns true if over item limit
*/
protected modHasReachedItemLimit(botRole: string, modTpl: string, modLimits: BotModLimits): boolean;
/**
* Initalise mod limits to be used when generating the weapon
* @param botRole "assault", "bossTagilla" or "pmc"
* @returns
*/
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
@ -65,7 +97,21 @@ export declare class BotGeneratorHelper {
* @param modSlot Slot to generate mods for
* @param itemModPool base mod pool to replace values of
*/
protected generateDynamicModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record<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
* @param modTpl item to check is limited

View File

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

View File

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

View File

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

View File

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

View File

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

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

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

View File

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

View File

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

View File

@ -1,4 +1,5 @@
export declare class LootItem {
id?: string;
tpl: string;
isPreset: boolean;
stackCount: 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)
*/
protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void;
/**
* Sort a pool of item objects by its flea price
* @param poolToSort pool of items to sort
*/
protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void;
/**
* Add unique items into combined pool
* @param combinedItemPool Pool of items to add to
* @param itemsToAdd items to add to combined pool if unique
*/
protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void;
/**
* Ammo/grenades have this property
* @param props

View File

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

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
* @param {array} list The array we want to draw randomly from
* @param {integer} count The number of times we want to draw
* @param {boolean} replacement Draw with ot without replacement from the input array
* @param {boolean} replacement Draw with or without replacement from the input array
* @return {array} Array consisting of N random elements
*/
drawRandomFromList<T>(list: Array<T>, count?: number, replacement?: boolean): Array<T>;

View File

@ -4,7 +4,7 @@ export declare class ContextVariable {
private timestamp;
private type;
constructor(value: any, type: ContextVariableType);
getValue(): any;
getValue<T>(): T;
getTimestamp(): Date;
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 { Difficulty } from "../models/eft/common/tables/IBotType";
import { IBotConfig } from "../models/spt/config/IBotConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { BotGenerationCacheService } from "../services/BotGenerationCacheService";
import { PmcAiService } from "../services/PmcAiService";
export declare class BotController {
protected logger: ILogger;
protected databaseServer: DatabaseServer;
protected botGenerator: BotGenerator;
protected botHelper: BotHelper;
protected pmcAiService: PmcAiService;
protected botGenerationCacheService: BotGenerationCacheService;
protected configServer: ConfigServer;
protected 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
* @param type bot Type we want the loadout gen count for
@ -29,7 +35,7 @@ export declare class BotController {
* @returns Difficulty object
*/
getBotDifficulty(type: string, difficulty: string): Difficulty;
protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string): Difficulty;
protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty;
generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[];
getBotCap(): number;
}

View File

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

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

View File

@ -67,7 +67,7 @@ export declare class BotWeaponGenerator {
* @param botRole for durability values
* @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
* @param weaponTpl weapon to find preset for

View File

@ -6,14 +6,16 @@ import { LootRequest } from "../models/spt/services/LootRequest";
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer";
import { ItemFilterService } from "../services/ItemFilterService";
import { HashUtil } from "../utils/HashUtil";
import { RandomUtil } from "../utils/RandomUtil";
export declare class LootGenerator {
protected logger: ILogger;
protected hashUtil: HashUtil;
protected databaseServer: DatabaseServer;
protected randomUtil: RandomUtil;
protected itemHelper: ItemHelper;
protected itemFilterService: ItemFilterService;
constructor(logger: ILogger, 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
* @param options parameters to adjust what loot is generated

View File

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

View File

@ -17,6 +17,17 @@ 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;
@ -58,6 +69,27 @@ export declare class BotGeneratorHelper {
* @returns Weapon with mods
*/
generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[];
/**
* 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 modTpl mods tpl
* @param modLimits limits set for weapon being generated for this bot
* @returns true if over item limit
*/
protected modHasReachedItemLimit(botRole: string, modTpl: string, modLimits: BotModLimits): boolean;
/**
* Initalise mod limits to be used when generating the weapon
* @param botRole "assault", "bossTagilla" or "pmc"
* @returns
*/
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
@ -65,7 +97,21 @@ export declare class BotGeneratorHelper {
* @param modSlot Slot to generate mods for
* @param itemModPool base mod pool to replace values of
*/
protected generateDynamicModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record<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
* @param modTpl item to check is limited

View File

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

View File

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

View File

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

View File

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

View File

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

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

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

View File

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

View File

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

View File

@ -1,4 +1,5 @@
export declare class LootItem {
id?: string;
tpl: string;
isPreset: boolean;
stackCount: 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)
*/
protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void;
/**
* Sort a pool of item objects by its flea price
* @param poolToSort pool of items to sort
*/
protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void;
/**
* Add unique items into combined pool
* @param combinedItemPool Pool of items to add to
* @param itemsToAdd items to add to combined pool if unique
*/
protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void;
/**
* Ammo/grenades have this property
* @param props

View File

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

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
* @param {array} list The array we want to draw randomly from
* @param {integer} count The number of times we want to draw
* @param {boolean} replacement Draw with ot without replacement from the input array
* @param {boolean} replacement Draw with or without replacement from the input array
* @return {array} Array consisting of N random elements
*/
drawRandomFromList<T>(list: Array<T>, count?: number, replacement?: boolean): Array<T>;

View File

@ -4,7 +4,7 @@ export declare class ContextVariable {
private timestamp;
private type;
constructor(value: any, type: ContextVariableType);
getValue(): any;
getValue<T>(): T;
getTimestamp(): Date;
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 { Difficulty } from "../models/eft/common/tables/IBotType";
import { IBotConfig } from "../models/spt/config/IBotConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { BotGenerationCacheService } from "../services/BotGenerationCacheService";
import { PmcAiService } from "../services/PmcAiService";
export declare class BotController {
protected logger: ILogger;
protected databaseServer: DatabaseServer;
protected botGenerator: BotGenerator;
protected botHelper: BotHelper;
protected pmcAiService: PmcAiService;
protected botGenerationCacheService: BotGenerationCacheService;
protected configServer: ConfigServer;
protected 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
* @param type bot Type we want the loadout gen count for
@ -29,7 +35,7 @@ export declare class BotController {
* @returns Difficulty object
*/
getBotDifficulty(type: string, difficulty: string): Difficulty;
protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string): Difficulty;
protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty;
generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[];
getBotCap(): number;
}

View File

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

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

View File

@ -67,7 +67,7 @@ export declare class BotWeaponGenerator {
* @param botRole for durability values
* @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
* @param weaponTpl weapon to find preset for

View File

@ -6,14 +6,16 @@ import { LootRequest } from "../models/spt/services/LootRequest";
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer";
import { ItemFilterService } from "../services/ItemFilterService";
import { HashUtil } from "../utils/HashUtil";
import { RandomUtil } from "../utils/RandomUtil";
export declare class LootGenerator {
protected logger: ILogger;
protected hashUtil: HashUtil;
protected databaseServer: DatabaseServer;
protected randomUtil: RandomUtil;
protected itemHelper: ItemHelper;
protected itemFilterService: ItemFilterService;
constructor(logger: ILogger, 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
* @param options parameters to adjust what loot is generated

View File

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

View File

@ -17,6 +17,17 @@ 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;
@ -58,6 +69,27 @@ export declare class BotGeneratorHelper {
* @returns Weapon with mods
*/
generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[];
/**
* 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 modTpl mods tpl
* @param modLimits limits set for weapon being generated for this bot
* @returns true if over item limit
*/
protected modHasReachedItemLimit(botRole: string, modTpl: string, modLimits: BotModLimits): boolean;
/**
* Initalise mod limits to be used when generating the weapon
* @param botRole "assault", "bossTagilla" or "pmc"
* @returns
*/
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
@ -65,7 +97,21 @@ export declare class BotGeneratorHelper {
* @param modSlot Slot to generate mods for
* @param itemModPool base mod pool to replace values of
*/
protected generateDynamicModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record<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
* @param modTpl item to check is limited

View File

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

View File

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

View File

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

View File

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

View File

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

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

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

View File

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

View File

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

View File

@ -1,4 +1,5 @@
export declare class LootItem {
id?: string;
tpl: string;
isPreset: boolean;
stackCount: 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)
*/
protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void;
/**
* Sort a pool of item objects by its flea price
* @param poolToSort pool of items to sort
*/
protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void;
/**
* Add unique items into combined pool
* @param combinedItemPool Pool of items to add to
* @param itemsToAdd items to add to combined pool if unique
*/
protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void;
/**
* Ammo/grenades have this property
* @param props

View File

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

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
* @param {array} list The array we want to draw randomly from
* @param {integer} count The number of times we want to draw
* @param {boolean} replacement Draw with ot without replacement from the input array
* @param {boolean} replacement Draw with or without replacement from the input array
* @return {array} Array consisting of N random elements
*/
drawRandomFromList<T>(list: Array<T>, count?: number, replacement?: boolean): Array<T>;

View File

@ -4,7 +4,7 @@ export declare class ContextVariable {
private timestamp;
private type;
constructor(value: any, type: ContextVariableType);
getValue(): any;
getValue<T>(): T;
getTimestamp(): Date;
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 { Difficulty } from "../models/eft/common/tables/IBotType";
import { IBotConfig } from "../models/spt/config/IBotConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { BotGenerationCacheService } from "../services/BotGenerationCacheService";
import { PmcAiService } from "../services/PmcAiService";
export declare class BotController {
protected logger: ILogger;
protected databaseServer: DatabaseServer;
protected botGenerator: BotGenerator;
protected botHelper: BotHelper;
protected pmcAiService: PmcAiService;
protected botGenerationCacheService: BotGenerationCacheService;
protected configServer: ConfigServer;
protected 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
* @param type bot Type we want the loadout gen count for
@ -29,7 +35,7 @@ export declare class BotController {
* @returns Difficulty object
*/
getBotDifficulty(type: string, difficulty: string): Difficulty;
protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string): Difficulty;
protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty;
generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[];
getBotCap(): number;
}

View File

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

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

View File

@ -67,7 +67,7 @@ export declare class BotWeaponGenerator {
* @param botRole for durability values
* @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
* @param weaponTpl weapon to find preset for

View File

@ -6,14 +6,16 @@ import { LootRequest } from "../models/spt/services/LootRequest";
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer";
import { ItemFilterService } from "../services/ItemFilterService";
import { HashUtil } from "../utils/HashUtil";
import { RandomUtil } from "../utils/RandomUtil";
export declare class LootGenerator {
protected logger: ILogger;
protected hashUtil: HashUtil;
protected databaseServer: DatabaseServer;
protected randomUtil: RandomUtil;
protected itemHelper: ItemHelper;
protected itemFilterService: ItemFilterService;
constructor(logger: ILogger, 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
* @param options parameters to adjust what loot is generated

View File

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

View File

@ -17,6 +17,17 @@ 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;
@ -58,6 +69,27 @@ export declare class BotGeneratorHelper {
* @returns Weapon with mods
*/
generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[];
/**
* 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 modTpl mods tpl
* @param modLimits limits set for weapon being generated for this bot
* @returns true if over item limit
*/
protected modHasReachedItemLimit(botRole: string, modTpl: string, modLimits: BotModLimits): boolean;
/**
* Initalise mod limits to be used when generating the weapon
* @param botRole "assault", "bossTagilla" or "pmc"
* @returns
*/
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
@ -65,7 +97,21 @@ export declare class BotGeneratorHelper {
* @param modSlot Slot to generate mods for
* @param itemModPool base mod pool to replace values of
*/
protected generateDynamicModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record<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
* @param modTpl item to check is limited

View File

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

View File

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

View File

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

View File

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

View File

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

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

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

View File

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

View File

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

View File

@ -1,4 +1,5 @@
export declare class LootItem {
id?: string;
tpl: string;
isPreset: boolean;
stackCount: 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)
*/
protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void;
/**
* Sort a pool of item objects by its flea price
* @param poolToSort pool of items to sort
*/
protected sortPoolByRagfairPrice(poolToSort: ITemplateItem[]): void;
/**
* Add unique items into combined pool
* @param combinedItemPool Pool of items to add to
* @param itemsToAdd items to add to combined pool if unique
*/
protected addUniqueItemsToPool(combinedItemPool: ITemplateItem[], itemsToAdd: ITemplateItem[]): void;
/**
* Ammo/grenades have this property
* @param props

View File

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

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
* @param {array} list The array we want to draw randomly from
* @param {integer} count The number of times we want to draw
* @param {boolean} replacement Draw with ot without replacement from the input array
* @param {boolean} replacement Draw with or without replacement from the input array
* @return {array} Array consisting of N random elements
*/
drawRandomFromList<T>(list: Array<T>, count?: number, replacement?: boolean): Array<T>;

View File

@ -4,7 +4,7 @@ export declare class ContextVariable {
private timestamp;
private type;
constructor(value: any, type: ContextVariableType);
getValue(): any;
getValue<T>(): T;
getTimestamp(): Date;
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 { Difficulty } from "../models/eft/common/tables/IBotType";
import { IBotConfig } from "../models/spt/config/IBotConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { BotGenerationCacheService } from "../services/BotGenerationCacheService";
import { PmcAiService } from "../services/PmcAiService";
export declare class BotController {
protected logger: ILogger;
protected databaseServer: DatabaseServer;
protected botGenerator: BotGenerator;
protected botHelper: BotHelper;
protected pmcAiService: PmcAiService;
protected botGenerationCacheService: BotGenerationCacheService;
protected configServer: ConfigServer;
protected 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
* @param type bot Type we want the loadout gen count for
@ -29,7 +35,7 @@ export declare class BotController {
* @returns Difficulty object
*/
getBotDifficulty(type: string, difficulty: string): Difficulty;
protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string): Difficulty;
protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty;
generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[];
getBotCap(): number;
}

View File

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

Some files were not shown because too many files have changed in this diff Show More