Update types for 3.5.4

This commit is contained in:
Dev 2023-03-23 14:39:36 +00:00
parent af9cacc6e9
commit 33f835fb83
609 changed files with 5277 additions and 1863 deletions

View File

@ -13,6 +13,7 @@ import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService";
import { LocalisationService } from "../services/LocalisationService"; import { LocalisationService } from "../services/LocalisationService";
import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService";
import { JsonUtil } from "../utils/JsonUtil"; import { JsonUtil } from "../utils/JsonUtil";
export declare class BotController { export declare class BotController {
protected logger: ILogger; protected logger: ILogger;
@ -21,6 +22,7 @@ export declare class BotController {
protected botHelper: BotHelper; protected botHelper: BotHelper;
protected botDifficultyHelper: BotDifficultyHelper; protected botDifficultyHelper: BotDifficultyHelper;
protected botGenerationCacheService: BotGenerationCacheService; protected botGenerationCacheService: BotGenerationCacheService;
protected matchBotDetailsCacheService: MatchBotDetailsCacheService;
protected localisationService: LocalisationService; protected localisationService: LocalisationService;
protected profileHelper: ProfileHelper; protected profileHelper: ProfileHelper;
protected configServer: ConfigServer; protected configServer: ConfigServer;
@ -28,7 +30,7 @@ export declare class BotController {
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected botConfig: IBotConfig; protected botConfig: IBotConfig;
static readonly pmcTypeLabel = "PMC"; static readonly pmcTypeLabel = "PMC";
constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil);
/** /**
* Return the number of bot loadout varieties to be generated * Return the number of bot loadout varieties to be generated
* @param type bot Type we want the loadout gen count for * @param type bot Type we want the loadout gen count for

View File

@ -43,6 +43,11 @@ export declare class GameController {
protected locationConfig: ILocationConfig; protected locationConfig: ILocationConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer); constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer);
gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void;
/**
* Players set botReload to a high value and don't expect the crazy fast reload speeds, give them a warn about it
* @param pmcProfile Player profile
*/
protected warnOnActiveBotReloadSkill(pmcProfile: IPmcData): void;
/** /**
* When player logs in, iterate over all active effects and reduce timer * When player logs in, iterate over all active effects and reduce timer
* TODO - add body part HP regen * TODO - add body part HP regen

View File

@ -19,6 +19,7 @@ import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { InsuranceService } from "../services/InsuranceService"; import { InsuranceService } from "../services/InsuranceService";
import { LocaleService } from "../services/LocaleService"; import { LocaleService } from "../services/LocaleService";
import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService";
import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { PmcChatResponseService } from "../services/PmcChatResponseService";
import { JsonUtil } from "../utils/JsonUtil"; import { JsonUtil } from "../utils/JsonUtil";
import { TimeUtil } from "../utils/TimeUtil"; import { TimeUtil } from "../utils/TimeUtil";
@ -33,6 +34,7 @@ export declare class InraidController {
protected databaseServer: DatabaseServer; protected databaseServer: DatabaseServer;
protected localeService: LocaleService; protected localeService: LocaleService;
protected pmcChatResponseService: PmcChatResponseService; protected pmcChatResponseService: PmcChatResponseService;
protected matchBotDetailsCacheService: MatchBotDetailsCacheService;
protected questHelper: QuestHelper; protected questHelper: QuestHelper;
protected itemHelper: ItemHelper; protected itemHelper: ItemHelper;
protected profileHelper: ProfileHelper; protected profileHelper: ProfileHelper;
@ -46,7 +48,7 @@ export declare class InraidController {
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected airdropConfig: IAirdropConfig; protected airdropConfig: IAirdropConfig;
protected inraidConfig: IInRaidConfig; protected inraidConfig: IInRaidConfig;
constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer);
/** /**
* Save locationId to active profiles inraid object AND app context * Save locationId to active profiles inraid object AND app context
* @param sessionID Session id * @param sessionID Session id

View File

@ -3,20 +3,28 @@ import { IChangeRequestData } from "../models/eft/launcher/IChangeRequestData";
import { ILoginRequestData } from "../models/eft/launcher/ILoginRequestData"; import { ILoginRequestData } from "../models/eft/launcher/ILoginRequestData";
import { IRegisterData } from "../models/eft/launcher/IRegisterData"; import { IRegisterData } from "../models/eft/launcher/IRegisterData";
import { Info } from "../models/eft/profile/IAkiProfile"; import { Info } from "../models/eft/profile/IAkiProfile";
import { IConnectResponse } from "../models/eft/profile/IConnectResponse";
import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ICoreConfig } from "../models/spt/config/ICoreConfig";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { LocalisationService } from "../services/LocalisationService";
import { HashUtil } from "../utils/HashUtil"; import { HashUtil } from "../utils/HashUtil";
export declare class LauncherController { export declare class LauncherController {
protected hashUtil: HashUtil; protected hashUtil: HashUtil;
protected saveServer: SaveServer; protected saveServer: SaveServer;
protected httpServerHelper: HttpServerHelper; protected httpServerHelper: HttpServerHelper;
protected databaseServer: DatabaseServer; protected databaseServer: DatabaseServer;
protected localisationService: LocalisationService;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected coreConfig: ICoreConfig; protected coreConfig: ICoreConfig;
constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, configServer: ConfigServer); constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer);
connect(): any; connect(): IConnectResponse;
/**
* Get descriptive text for each of the profile edtions a player can choose
* @returns
*/
protected getProfileDescriptions(): Record<string, string>;
find(sessionIdKey: string): Info; find(sessionIdKey: string): Info;
login(info: ILoginRequestData): string; login(info: ILoginRequestData): string;
register(info: IRegisterData): string; register(info: IRegisterData): string;

View File

@ -1,9 +1,12 @@
import { LocationGenerator } from "../generators/LocationGenerator"; import { LocationGenerator } from "../generators/LocationGenerator";
import { LootGenerator } from "../generators/LootGenerator"; import { LootGenerator } from "../generators/LootGenerator";
import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper";
import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationBase } from "../models/eft/common/ILocationBase";
import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase";
import { AirdropTypeEnum } from "../models/enums/AirdropType";
import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig";
import { LootItem } from "../models/spt/services/LootItem"; import { LootItem } from "../models/spt/services/LootItem";
import { LootRequest } from "../models/spt/services/LootRequest";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
@ -14,6 +17,7 @@ import { TimeUtil } from "../utils/TimeUtil";
export declare class LocationController { export declare class LocationController {
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected hashUtil: HashUtil; protected hashUtil: HashUtil;
protected weightedRandomHelper: WeightedRandomHelper;
protected logger: ILogger; protected logger: ILogger;
protected locationGenerator: LocationGenerator; protected locationGenerator: LocationGenerator;
protected localisationService: LocalisationService; protected localisationService: LocalisationService;
@ -22,14 +26,29 @@ export declare class LocationController {
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected airdropConfig: IAirdropConfig; protected airdropConfig: IAirdropConfig;
constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer);
get(location: string): ILocationBase; get(location: string): ILocationBase;
generate(name: string): ILocationBase; generate(name: string): ILocationBase;
/**
* Get all maps base location properties without loot data
* @returns ILocationsGenerateAllResponse
*/
generateAll(): ILocationsGenerateAllResponse; generateAll(): ILocationsGenerateAllResponse;
/** /**
* Get loot for an airdop container * Get loot for an airdop container
* Generates it randomly based on config/airdrop.json values * Generates it randomly based on config/airdrop.json values
* @returns Array of LootItem * @returns Array of LootItem objects
*/ */
getAirdropLoot(): LootItem[]; getAirdropLoot(): LootItem[];
/**
* Randomly pick a type of airdrop loot using weighted values from config
* @returns airdrop type value
*/
protected chooseAirdropType(): AirdropTypeEnum;
/**
* Get the configuration for a specific type of airdrop
* @param airdropType Type of airdrop to get settings for
* @returns LootRequest
*/
protected getAirdropLootConfigByType(airdropType: AirdropTypeEnum): LootRequest;
} }

View File

@ -4,7 +4,8 @@ import { ProfileHelper } from "../helpers/ProfileHelper";
import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; import { QuestConditionHelper } from "../helpers/QuestConditionHelper";
import { QuestHelper } from "../helpers/QuestHelper"; import { QuestHelper } from "../helpers/QuestHelper";
import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcData } from "../models/eft/common/IPmcData";
import { IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { Item } from "../models/eft/common/tables/IItem";
import { AvailableForConditions, IQuest, Reward } from "../models/eft/common/tables/IQuest";
import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests";
import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse";
import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData";
@ -46,10 +47,10 @@ export declare class QuestController {
getClientQuests(sessionID: string): IQuest[]; getClientQuests(sessionID: string): IQuest[];
/** /**
* Is the quest for the opposite side the player is on * Is the quest for the opposite side the player is on
* @param side player side (usec/bear) * @param playerSide Player side (usec/bear)
* @param questId questId to check * @param questId QuestId to check
*/ */
protected questIsForOtherSide(side: string, questId: string): boolean; protected questIsForOtherSide(playerSide: string, questId: string): boolean;
/** /**
* Handle the client accepting a quest and starting it * Handle the client accepting a quest and starting it
* Send starting rewards if any to player and * Send starting rewards if any to player and
@ -124,6 +125,22 @@ export declare class QuestController {
* @returns IItemEventRouterResponse * @returns IItemEventRouterResponse
*/ */
handoverQuest(pmcData: IPmcData, handoverQuestRequest: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; handoverQuest(pmcData: IPmcData, handoverQuestRequest: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse;
/**
* Show warning to user and write to log that repeatable quest failed a condition check
* @param handoverQuestRequest Quest request
* @param output Response to send to user
* @returns IItemEventRouterResponse
*/
protected showRepeatableQuestInvalidConditionError(handoverQuestRequest: IHandoverQuestRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse;
/**
* Show warning to user and write to log quest item handed over did not match what is required
* @param handoverQuestRequest Quest request
* @param itemHandedOver Non-matching item found
* @param handoverRequirements Quest handover requirements
* @param output Response to send to user
* @returns IItemEventRouterResponse
*/
protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse;
/** /**
* Increment a backend counter stored value by an amount, * Increment a backend counter stored value by an amount,
* Create counter if it does not exist * Create counter if it does not exist

View File

@ -96,7 +96,7 @@ export declare class BotEquipmentModGenerator {
*/ */
protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot;
/** /**
* randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * Randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot
* never return true for an item that has 0% spawn chance * never return true for an item that has 0% spawn chance
* @param itemSlot slot the item sits in * @param itemSlot slot the item sits in
* @param modSlot slot the mod sits in * @param modSlot slot the mod sits in

View File

@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper";
import { BotHelper } from "../helpers/BotHelper"; import { BotHelper } from "../helpers/BotHelper";
import { ProfileHelper } from "../helpers/ProfileHelper"; import { ProfileHelper } from "../helpers/ProfileHelper";
import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper";
import { Health as PmcHealth, IBotBase, Info, Skills } from "../models/eft/common/tables/IBotBase"; import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase";
import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { Health, IBotType } from "../models/eft/common/tables/IBotType";
import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails";
import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IBotConfig } from "../models/spt/config/IBotConfig";
@ -84,7 +84,18 @@ export declare class BotGenerator {
* @returns PmcHealth object * @returns PmcHealth object
*/ */
protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth;
protected generateSkills(skillsObj: Skills): Skills; /**
* Get a bots skills with randomsied progress value between the min and max values
* @param botSkills Skills that should have their progress value randomised
* @returns
*/
protected generateSkills(botSkills: IBaseJsonSkills): botSkills;
/**
* Randomise the progress value of passed in skills based on the min/max value
* @param skills Skills to randomise
* @returns Skills with randomised progress values as an array
*/
protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[];
/** /**
* Generate a random Id for a bot and apply to bots _id and aid value * Generate a random Id for a bot and apply to bots _id and aid value
* @param bot bot to update * @param bot bot to update

View File

@ -34,7 +34,7 @@ export declare class BotInventoryGenerator {
/** /**
* Add equipment/weapons/loot to bot * Add equipment/weapons/loot to bot
* @param sessionId Session id * @param sessionId Session id
* @param botJsonTemplate bot/x.json data from db * @param botJsonTemplate Base json db file for the bot having its loot generated
* @param botRole Role bot has (assault/pmcBot) * @param botRole Role bot has (assault/pmcBot)
* @param isPmc Is bot being converted into a pmc * @param isPmc Is bot being converted into a pmc
* @param botLevel Level of bot being generated * @param botLevel Level of bot being generated

View File

@ -3,7 +3,7 @@ import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper";
import { HandbookHelper } from "../helpers/HandbookHelper"; import { HandbookHelper } from "../helpers/HandbookHelper";
import { ItemHelper } from "../helpers/ItemHelper"; import { ItemHelper } from "../helpers/ItemHelper";
import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase";
import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; import { IBotType, Inventory, ModsChances } from "../models/eft/common/tables/IBotType";
import { Item } from "../models/eft/common/tables/IItem"; import { Item } from "../models/eft/common/tables/IItem";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IBotConfig } from "../models/spt/config/IBotConfig";
@ -33,15 +33,13 @@ export declare class BotLootGenerator {
/** /**
* Add loot to bots containers * Add loot to bots containers
* @param sessionId Session id * @param sessionId Session id
* @param templateInventory x.json from database/bots * @param botJsonTemplate Base json db file for the bot having its loot generated
* @param itemCounts Liits on item types to be added as loot
* @param isPmc Will bot be a pmc * @param isPmc Will bot be a pmc
* @param botRole Role of bot, e.g. asssult * @param botRole Role of bot, e.g. asssult
* @param botInventory Inventory to add loot to * @param botInventory Inventory to add loot to
* @param equipmentChances
* @param botLevel Level of bot * @param botLevel Level of bot
*/ */
generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; generateLoot(sessionId: string, botJsonTemplate: IBotType, isPmc: boolean, botRole: string, botInventory: PmcInventory, botLevel: number): void;
protected getRandomisedCount(min: number, max: number, nValue: number): number; protected getRandomisedCount(min: number, max: number, nValue: number): number;
/** /**
* Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached

View File

@ -23,7 +23,7 @@ export declare class LootGenerator {
* @param options parameters to adjust how loot is generated * @param options parameters to adjust how loot is generated
* @returns An array of loot items * @returns An array of loot items
*/ */
createRandomloot(options: LootRequest): LootItem[]; createRandomLoot(options: LootRequest): LootItem[];
/** /**
* Construct item limit record to hold max and current item count * Construct item limit record to hold max and current item count
* @param limits limits as defined in config * @param limits limits as defined in config

View File

@ -31,7 +31,7 @@ export declare class PMCLootGenerator {
*/ */
generatePMCVestLootPool(): string[]; generatePMCVestLootPool(): string[];
/** /**
* Check if item has a width/hide that lets it fit into a 1x2 slot * Check if item has a width/height that lets it fit into a 1x2/2x1 slot
* 1x1 / 1x2 / 2x1 * 1x1 / 1x2 / 2x1
* @param item Item to check size of * @param item Item to check size of
* @returns true if it fits * @returns true if it fits

View File

@ -171,17 +171,19 @@ declare class ItemHelper {
*/ */
isItemTplStackable(tpl: string): boolean; isItemTplStackable(tpl: string): boolean;
/** /**
* split item stack if it exceeds StackMaxSize * split item stack if it exceeds its StackMaxSize property
* @param itemToSplit item being split into smaller stacks
* @returns Array of split items
*/ */
splitStack(item: Item): Item[]; splitStack(itemToSplit: Item): Item[];
/** /**
* Find Barter items in the inventory * Find Barter items in the inventory
* @param {string} by * @param {string} by tpl or id
* @param {Object} pmcData * @param {Object} pmcData
* @param {string} barterItemId * @param {string} barterItemId
* @returns Array of Item objects * @returns Array of Item objects
*/ */
findBarterItems(by: string, pmcData: IPmcData, barterItemId: string): Item[]; findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[];
/** /**
* *
* @param pmcData * @param pmcData

View File

@ -1,6 +1,11 @@
import { IInventoryConfig } from "../models/spt/config/IInventoryConfig";
import { ConfigServer } from "../servers/ConfigServer";
export declare class PaymentHelper { export declare class PaymentHelper {
protected configServer: ConfigServer;
protected inventoryConfig: IInventoryConfig;
constructor(configServer: ConfigServer);
/** /**
* Check whether tpl is Money * Is the passed in tpl money (also checks custom currencies in inventoryConfig.customMoneyTpls)
* @param {string} tpl * @param {string} tpl
* @returns void * @returns void
*/ */

View File

@ -1,5 +1,6 @@
import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcData } from "../models/eft/common/IPmcData";
import { Quest } from "../models/eft/common/tables/IBotBase"; import { Quest } from "../models/eft/common/tables/IBotBase";
import { Item } from "../models/eft/common/tables/IItem";
import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "../models/eft/common/tables/IQuest";
import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse";
import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData";
@ -42,10 +43,10 @@ export declare class QuestHelper {
/** /**
* Get status of a quest in player profile by its id * Get status of a quest in player profile by its id
* @param pmcData Profile to search * @param pmcData Profile to search
* @param questID Quest id to look up * @param questId Quest id to look up
* @returns QuestStatus enum * @returns QuestStatus enum
*/ */
getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus; getQuestStatus(pmcData: IPmcData, questId: string): QuestStatus;
/** /**
* returns true is the level condition is satisfied * returns true is the level condition is satisfied
* @param playerLevel Players level * @param playerLevel Players level
@ -81,14 +82,19 @@ export declare class QuestHelper {
* @returns true if loyalty is high enough to fulfill quest requirement * @returns true if loyalty is high enough to fulfill quest requirement
*/ */
traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean;
/**
* take reward item from quest and set FiR status + fix stack sizes + fix mod Ids
* @param reward Reward item to fix
* @returns Fixed rewards
*/
protected processReward(reward: Reward): Reward[]; protected processReward(reward: Reward): Reward[];
/** /**
* Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success)
* @param quest quest to get rewards for * @param quest quest to get rewards for
* @param state Quest status that holds the items (Started, Success, Fail) * @param status Quest status that holds the items (Started, Success, Fail)
* @returns array of items with the correct maxStack * @returns array of items with the correct maxStack
*/ */
getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[];
/** /**
* Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile
* @param pmcData Player profile * @param pmcData Player profile
@ -97,19 +103,19 @@ export declare class QuestHelper {
*/ */
getQuestReadyForProfile(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): Quest; getQuestReadyForProfile(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): Quest;
/** /**
* TODO: what is going on here * Get quests that can be shown to player after starting a quest
* @param acceptedQuestId Quest to add to profile * @param startedQuestId Quest started by player
* @param sessionID Session id * @param sessionID Session id
* @returns Array of quests in profile + quest passed in as param * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started
*/ */
acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[];
/** /**
* TODO: what is going on here * Get quests that can be shown to player after failing a quest
* @param failedQuestId * @param failedQuestId Id of the quest failed by player
* @param sessionID Session id * @param sessionId Session id
* @returns * @returns
*/ */
failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; failedUnlocked(failedQuestId: string, sessionId: string): IQuest[];
/** /**
* Adjust quest money rewards by passed in multiplier * Adjust quest money rewards by passed in multiplier
* @param quest Quest to multiple money rewards * @param quest Quest to multiple money rewards
@ -127,6 +133,13 @@ export declare class QuestHelper {
* @param output ItemEvent router response * @param output ItemEvent router response
*/ */
changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void;
/**
* Add item stack change object into output route event response
* @param output Response to add item change event into
* @param sessionId Session id
* @param item Item that was adjusted
*/
protected addItemStackSizeChangeIntoEventResponse(output: IItemEventRouterResponse, sessionId: string, item: Item): void;
/** /**
* Get quests, strip all requirement conditions except level * Get quests, strip all requirement conditions except level
* @param quests quests to process * @param quests quests to process

View File

@ -8,8 +8,10 @@ import { SaveServer } from "../servers/SaveServer";
import { FenceService } from "../services/FenceService"; import { FenceService } from "../services/FenceService";
import { LocalisationService } from "../services/LocalisationService"; import { LocalisationService } from "../services/LocalisationService";
import { PlayerService } from "../services/PlayerService"; import { PlayerService } from "../services/PlayerService";
import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil"; import { TimeUtil } from "../utils/TimeUtil";
import { HandbookHelper } from "./HandbookHelper"; import { HandbookHelper } from "./HandbookHelper";
import { ItemHelper } from "./ItemHelper";
import { ProfileHelper } from "./ProfileHelper"; import { ProfileHelper } from "./ProfileHelper";
export declare class TraderHelper { export declare class TraderHelper {
protected logger: ILogger; protected logger: ILogger;
@ -17,15 +19,19 @@ export declare class TraderHelper {
protected saveServer: SaveServer; protected saveServer: SaveServer;
protected profileHelper: ProfileHelper; protected profileHelper: ProfileHelper;
protected handbookHelper: HandbookHelper; protected handbookHelper: HandbookHelper;
protected itemHelper: ItemHelper;
protected playerService: PlayerService; protected playerService: PlayerService;
protected localisationService: LocalisationService; protected localisationService: LocalisationService;
protected fenceService: FenceService; protected fenceService: FenceService;
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
protected randomUtil: RandomUtil;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected traderConfig: ITraderConfig; protected traderConfig: ITraderConfig;
/** Dictionary of item tpl and the highest trader rouble price */ /** Dictionary of item tpl and the highest trader sell rouble price */
protected highestTraderPriceItems: Record<string, number>; protected highestTraderPriceItems: Record<string, number>;
constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); /** Dictionary of item tpl and the highest trader buy back rouble price */
protected highestTraderBuyPriceItems: Record<string, number>;
constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer);
getTrader(traderID: string, sessionID: string): ITraderBase; getTrader(traderID: string, sessionID: string): ITraderBase;
getTraderAssortsById(traderId: string): ITraderAssort; getTraderAssortsById(traderId: string): ITraderAssort;
/** /**
@ -82,8 +88,15 @@ export declare class TraderHelper {
}): void; }): void;
/** /**
* Get the highest rouble price for an item from traders * Get the highest rouble price for an item from traders
* UNUSED
* @param tpl Item to look up highest pride for * @param tpl Item to look up highest pride for
* @returns highest rouble cost for item * @returns highest rouble cost for item
*/ */
getHighestTraderPriceRouble(tpl: string): number; getHighestTraderPriceRouble(tpl: string): number;
/**
* Get the highest price item can be sold to trader for (roubles)
* @param tpl Item to look up best trader sell-to price
* @returns Rouble price
*/
getHighestSellToTraderPrice(tpl: string): number;
} }

View File

@ -1,5 +1,6 @@
export declare class WeightedRandomHelper { export declare class WeightedRandomHelper {
/** /**
* USE getWeightedValue() WHERE POSSIBLE
* Gets a tplId from a weighted dictionary * Gets a tplId from a weighted dictionary
* @param {tplId: weighting[]} itemArray * @param {tplId: weighting[]} itemArray
* @returns tplId * @returns tplId
@ -7,6 +8,9 @@ export declare class WeightedRandomHelper {
getWeightedInventoryItem(itemArray: { getWeightedInventoryItem(itemArray: {
[tplId: string]: unknown; [tplId: string]: unknown;
} | ArrayLike<unknown>): string; } | ArrayLike<unknown>): string;
getWeightedValue<T>(itemArray: {
[key: string]: unknown;
} | ArrayLike<unknown>): T;
/** /**
* Picks the random item based on its weight. * Picks the random item based on its weight.
* The items with higher weight will be picked more often (with a higher probability). * The items with higher weight will be picked more often (with a higher probability).

View File

@ -122,24 +122,27 @@ export interface Inventory {
questStashItems: string; questStashItems: string;
fastPanel: Record<string, string>; fastPanel: Record<string, string>;
} }
export interface IBaseJsonSkills {
Common: Record<string, Common>;
Mastering: Record<string, Mastering>;
Points: number;
}
export interface Skills { export interface Skills {
Common: Common[]; Common: Common[];
Mastering: Mastering[]; Mastering: Mastering[];
Points: number; Points: number;
} }
export interface Common { export interface IBaseSkill {
Id: string; Id: string;
Progress: number; Progress: number;
PointsEarnedDuringSession?: number;
LastAccess?: number;
max?: number; max?: number;
min?: number; min?: number;
} }
export interface Mastering { export interface Common extends IBaseSkill {
Id: string; PointsEarnedDuringSession?: number;
Progress: number; LastAccess?: number;
max?: number; }
min?: number; export interface Mastering extends IBaseSkill {
} }
export interface Stats { export interface Stats {
CarriedQuestItems: string[]; CarriedQuestItems: string[];

View File

@ -104,13 +104,17 @@ export interface Generation {
items: ItemMinMax; items: ItemMinMax;
} }
export interface ItemMinMax { export interface ItemMinMax {
grenades: MinMax; grenades: MinMaxWithWhitelist;
healing: MinMax; healing: MinMaxWithWhitelist;
drugs: MinMax; drugs: MinMaxWithWhitelist;
stims: MinMax; stims: MinMaxWithWhitelist;
looseLoot: MinMax; looseLoot: MinMaxWithWhitelist;
magazines: MinMax; magazines: MinMaxWithWhitelist;
specialItems: MinMax; specialItems: MinMaxWithWhitelist;
}
export interface MinMaxWithWhitelist extends MinMax {
/** Array of item tpls */
whitelist: string[];
} }
export interface Health { export interface Health {
BodyParts: BodyPart[]; BodyParts: BodyPart[];

View File

@ -0,0 +1,6 @@
export interface IConnectResponse {
backendUrl: string;
name: string;
editions: string[];
profileDescriptions: Record<string, string>;
}

View File

@ -0,0 +1,6 @@
export declare enum AirdropTypeEnum {
MIXED = "mixed",
WEAPONARMOR = "weaponarmor",
FOODMEDICAL = "foodmedical",
BARTER = "barter"
}

View File

@ -28,6 +28,6 @@ export declare enum WildSpawnTypeNumber {
BOSSKNIGHT = 67108864, BOSSKNIGHT = 67108864,
FOLLOWERBIGPIPE = 134217728, FOLLOWERBIGPIPE = 134217728,
FOLLOWERBIRDEYE = 268435456, FOLLOWERBIRDEYE = 268435456,
SPTUSEC = 536870912, BOSSZRYACHIY = 536870912,
SPTBEAR = 1073741824 FOLLOWERZRYACHIY = 1073741824
} }

View File

@ -1,5 +1,5 @@
import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; import { ITemplateItem } from "../../eft/common/tables/ITemplateItem";
export declare class BotLootCache { export interface IBotLootCache {
backpackLoot: ITemplateItem[]; backpackLoot: ITemplateItem[];
pocketLoot: ITemplateItem[]; pocketLoot: ITemplateItem[];
vestLoot: ITemplateItem[]; vestLoot: ITemplateItem[];

View File

@ -1,8 +1,10 @@
import { AirdropTypeEnum } from "../../../models/enums/AirdropType";
import { MinMax } from "../../common/MinMax"; import { MinMax } from "../../common/MinMax";
import { IBaseConfig } from "./IBaseConfig"; import { IBaseConfig } from "./IBaseConfig";
export interface IAirdropConfig extends IBaseConfig { export interface IAirdropConfig extends IBaseConfig {
kind: "aki-airdrop"; kind: "aki-airdrop";
airdropChancePercent: AirdropChancePercent; airdropChancePercent: AirdropChancePercent;
airdropTypeWeightings: Record<AirdropTypeEnum, number>;
planeMinFlyHeight: number; planeMinFlyHeight: number;
planeMaxFlyHeight: number; planeMaxFlyHeight: number;
planeVolume: number; planeVolume: number;
@ -10,7 +12,7 @@ export interface IAirdropConfig extends IBaseConfig {
crateFallSpeed: number; crateFallSpeed: number;
airdropMinStartTimeSeconds: number; airdropMinStartTimeSeconds: number;
airdropMaxStartTimeSeconds: number; airdropMaxStartTimeSeconds: number;
loot: AirdropLoot; loot: Record<string, AirdropLoot>;
} }
export interface AirdropChancePercent { export interface AirdropChancePercent {
bigmap: number; bigmap: number;
@ -22,12 +24,12 @@ export interface AirdropChancePercent {
tarkovStreets: number; tarkovStreets: number;
} }
export interface AirdropLoot { export interface AirdropLoot {
presetCount: MinMax; presetCount?: MinMax;
itemCount: MinMax; itemCount: MinMax;
itemBlacklist: string[]; itemBlacklist: string[];
itemTypeWhitelist: string[]; itemTypeWhitelist: string[];
/** key: item base type: value: max count */ /** key: item base type: value: max count */
itemLimits: Record<string, number>; itemLimits: Record<string, number>;
itemStackLimits: Record<string, MinMax>; itemStackLimits: Record<string, MinMax>;
armorLevelWhitelist: number[]; armorLevelWhitelist?: number[];
} }

View File

@ -1,3 +1,4 @@
import { MinMaxWithWhitelist } from "../../../models/eft/common/tables/IBotType";
import { MinMax } from "../../common/MinMax"; import { MinMax } from "../../common/MinMax";
import { IBaseConfig } from "./IBaseConfig"; import { IBaseConfig } from "./IBaseConfig";
import { IBotDurability } from "./IBotDurability"; import { IBotDurability } from "./IBotDurability";
@ -85,7 +86,7 @@ export interface ModLimits {
} }
export interface RandomisationDetails { export interface RandomisationDetails {
levelRange: MinMax; levelRange: MinMax;
generation?: Record<string, MinMax>; generation?: Record<string, MinMaxWithWhitelist>;
randomisedWeaponModSlots?: string[]; randomisedWeaponModSlots?: string[];
randomisedArmorSlots?: string[]; randomisedArmorSlots?: string[];
/** Equipment chances */ /** Equipment chances */

View File

@ -4,5 +4,6 @@ export interface ICoreConfig extends IBaseConfig {
akiVersion: string; akiVersion: string;
projectName: string; projectName: string;
compatibleTarkovVersion: string; compatibleTarkovVersion: string;
serverName: string;
commit: string; commit: string;
} }

View File

@ -3,6 +3,8 @@ export interface IInventoryConfig extends IBaseConfig {
kind: "aki-inventory"; kind: "aki-inventory";
newItemsMarkedFound: boolean; newItemsMarkedFound: boolean;
randomLootContainers: Record<string, RewardDetails>; randomLootContainers: Record<string, RewardDetails>;
/** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */
customMoneyTpls: string[];
} }
export interface RewardDetails { export interface RewardDetails {
rewardCount: number; rewardCount: number;

View File

@ -2,16 +2,24 @@ import { MinMax } from "../../common/MinMax";
import { IBaseConfig } from "./IBaseConfig"; import { IBaseConfig } from "./IBaseConfig";
export interface IRagfairConfig extends IBaseConfig { export interface IRagfairConfig extends IBaseConfig {
kind: "aki-ragfair"; kind: "aki-ragfair";
/** How many seconds should pass before expired offers and procesed + player offers checked if sold */
runIntervalSeconds: number; runIntervalSeconds: number;
/** Player listing settings */
sell: Sell; sell: Sell;
/** Trader ids + should their assorts be listed on flea*/
traders: Record<string, boolean>; traders: Record<string, boolean>;
dynamic: Dynamic; dynamic: Dynamic;
} }
export interface Sell { export interface Sell {
/** Should a fee be deducted from player when liting an item for sale */
fees: boolean; fees: boolean;
/** Settings to control chances of offer being sold */
chance: Chance; chance: Chance;
/** Settings to control how long it takes for a player offer to sell */
time: Time; time: Time;
/** Player offer reputation gain/loss settings */
reputation: Reputation; reputation: Reputation;
/** How many hours are simulated to figure out if player offer was sold */
simulatedSellHours: number; simulatedSellHours: number;
} }
export interface Chance { export interface Chance {
@ -32,48 +40,77 @@ export interface Dynamic {
purchasesAreFoundInRaid: boolean; purchasesAreFoundInRaid: boolean;
/** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */
useTraderPriceForOffersIfHigher: boolean; useTraderPriceForOffersIfHigher: boolean;
/** Barter offer specific settings */
barter: Barter; barter: Barter;
/** Dynamic offer price below handbook adjustment values */
offerAdjustment: OfferAdjustment; offerAdjustment: OfferAdjustment;
/** How many offers should expire before an offer regeneration occurs */
expiredOfferThreshold: number; expiredOfferThreshold: number;
/** How many offers should be listed */
offerItemCount: MinMax; offerItemCount: MinMax;
/** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */
price: MinMax; price: MinMax;
/** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */
presetPrice: MinMax; presetPrice: MinMax;
/** Should default presets to listed only or should non-standard presets found in globals.json be listed too */
showDefaultPresetsOnly: boolean; showDefaultPresetsOnly: boolean;
endTimeSeconds: MinMax; endTimeSeconds: MinMax;
/** Settings to control the durability range of item items listed on flea */
condition: Condition; condition: Condition;
/** Size stackable items should be listed for in percent of max stack size */
stackablePercent: MinMax; stackablePercent: MinMax;
/** Items that cannot be stacked can have multiples sold in one offer, what range of values can be listed */
nonStackableCount: MinMax; nonStackableCount: MinMax;
/** Range of rating offers for items being listed */
rating: MinMax; rating: MinMax;
/** Percentages to sell offers in each currency */
currencies: Record<string, number>; currencies: Record<string, number>;
/** Item tpls that should be forced to sell as a single item */
showAsSingleStack: string[]; showAsSingleStack: string[];
/** Should christmas/halloween items be removed from flea when not within the seasonal bounds */
removeSeasonalItemsWhenNotInEvent: boolean; removeSeasonalItemsWhenNotInEvent: boolean;
/** Flea blacklist settings */
blacklist: Blacklist; blacklist: Blacklist;
} }
export interface Barter { export interface Barter {
/** Should barter offers be generated */
enable: boolean; enable: boolean;
/** Percentage change an offer is listed as a barter */
chancePercent: number; chancePercent: number;
/** Min number of required items for a barter requirement */
itemCountMin: number; itemCountMin: number;
/** Max number of required items for a barter requirement */
itemCountMax: number; itemCountMax: number;
/** How much can the total price of requested items vary from the item offered */
priceRangeVariancePercent: number; priceRangeVariancePercent: number;
/** Min rouble price for an offer to be considered for turning into a barter */
minRoubleCostToBecomeBarter: number; minRoubleCostToBecomeBarter: number;
/** Item Tpls to never be turned into a barter */
itemTypeBlacklist: string[]; itemTypeBlacklist: string[];
} }
export interface OfferAdjustment { export interface OfferAdjustment {
/** Shuld offer price be adjusted when below handbook price */
adjustPriceWhenBelowHandbookPrice: boolean;
/** How big a percentage difference does price need to vary from handbook to be considered for adjustment */
maxPriceDifferenceBelowHandbookPercent: number; maxPriceDifferenceBelowHandbookPercent: number;
/** How much to multiply the handbook price to get the new price */
handbookPriceMultipier: number; handbookPriceMultipier: number;
/** What is the minimum rouble price to consider adjusting price of item */
priceThreshholdRub: number; priceThreshholdRub: number;
} }
export interface Condition { export interface Condition {
/** Percentage change durability is altered */
conditionChance: number; conditionChance: number;
min: number; min: number;
max: number; max: number;
} }
export interface Blacklist { export interface Blacklist {
/** /** Custom blacklist for item Tpls */
* show/hide trader items that are blacklisted by bsg
*/
traderItems: boolean;
custom: string[]; custom: string[];
/** BSG blacklist a large number of items from flea, true = use blacklist */
enableBsgList: boolean; enableBsgList: boolean;
/** Should quest items be blacklisted from flea */
enableQuestList: boolean; enableQuestList: boolean;
/** Should trader items that are blacklisted by bsg */
traderItems: boolean;
} }

View File

@ -1,5 +1,5 @@
import { MinMax } from "../../common/MinMax"; import { MinMax } from "../../common/MinMax";
export declare class LootRequest { export interface LootRequest {
presetCount: MinMax; presetCount: MinMax;
itemCount: MinMax; itemCount: MinMax;
itemBlacklist: string[]; itemBlacklist: string[];

View File

@ -1,6 +1,5 @@
import { BotHelper } from "../helpers/BotHelper"; import { BotHelper } from "../helpers/BotHelper";
import { MinMax } from "../models/common/MinMax"; import { EquipmentChances, Generation, IBotType, MinMaxWithWhitelist, ModsChances } from "../models/eft/common/tables/IBotType";
import { EquipmentChances, Generation, IBotType, ModsChances } from "../models/eft/common/tables/IBotType";
import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails";
import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
@ -30,7 +29,7 @@ export declare class BotEquipmentFilterService {
* @param generationChanges Changes to apply * @param generationChanges Changes to apply
* @param baseBotGeneration dictionary to update * @param baseBotGeneration dictionary to update
*/ */
protected adjustGenerationChances(generationChanges: Record<string, MinMax>, baseBotGeneration: Generation): void; protected adjustGenerationChances(generationChanges: Record<string, MinMaxWithWhitelist>, baseBotGeneration: Generation): void;
/** /**
* Get equipment settings for bot * Get equipment settings for bot
* @param botEquipmentRole equipment role to return * @param botEquipmentRole equipment role to return

View File

@ -1,7 +1,8 @@
import { PMCLootGenerator } from "../generators/PMCLootGenerator"; import { PMCLootGenerator } from "../generators/PMCLootGenerator";
import { Items } from "../models/eft/common/tables/IBotType"; import { ItemHelper } from "../helpers/ItemHelper";
import { IBotType } from "../models/eft/common/tables/IBotType";
import { ITemplateItem, Props } from "../models/eft/common/tables/ITemplateItem"; import { ITemplateItem, Props } from "../models/eft/common/tables/ITemplateItem";
import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; import { IBotLootCache, LootCacheType } from "../models/spt/bots/IBotLootCache";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { JsonUtil } from "../utils/JsonUtil"; import { JsonUtil } from "../utils/JsonUtil";
@ -10,12 +11,13 @@ import { RagfairPriceService } from "./RagfairPriceService";
export declare class BotLootCacheService { export declare class BotLootCacheService {
protected logger: ILogger; protected logger: ILogger;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected itemHelper: ItemHelper;
protected databaseServer: DatabaseServer; protected databaseServer: DatabaseServer;
protected pmcLootGenerator: PMCLootGenerator; protected pmcLootGenerator: PMCLootGenerator;
protected localisationService: LocalisationService; protected localisationService: LocalisationService;
protected ragfairPriceService: RagfairPriceService; protected ragfairPriceService: RagfairPriceService;
protected lootCache: Record<string, BotLootCache>; protected lootCache: Record<string, IBotLootCache>;
constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService);
/** /**
* Remove all cached bot loot data * Remove all cached bot loot data
*/ */
@ -25,17 +27,17 @@ export declare class BotLootCacheService {
* @param botRole bot to get loot for * @param botRole bot to get loot for
* @param isPmc is the bot a pmc * @param isPmc is the bot a pmc
* @param lootType what type of loot is needed (backpack/pocket/stim/vest etc) * @param lootType what type of loot is needed (backpack/pocket/stim/vest etc)
* @param lootPool the full pool of loot (needed when cache is empty) * @param botJsonTemplate Base json db file for the bot having its loot generated
* @returns ITemplateItem array * @returns ITemplateItem array
*/ */
getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, lootPool: Items): ITemplateItem[]; getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[];
/** /**
* Generate loot for a bot and store inside a private class property * Generate loot for a bot and store inside a private class property
* @param botRole bots role (assault / pmcBot etc) * @param botRole bots role (assault / pmcBot etc)
* @param lootPool the full pool of loot we use to create the various sub-categories with
* @param isPmc Is the bot a PMC (alteres what loot is cached) * @param isPmc Is the bot a PMC (alteres what loot is cached)
* @param botJsonTemplate db template for bot having its loot generated
*/ */
protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void;
/** /**
* Sort a pool of item objects by its flea price * Sort a pool of item objects by its flea price
* @param poolToSort pool of items to sort * @param poolToSort pool of items to sort

View File

@ -0,0 +1,23 @@
import { IBotBase } from "../models/eft/common/tables/IBotBase";
import { ILogger } from "../models/spt/utils/ILogger";
/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */
export declare class MatchBotDetailsCacheService {
protected logger: ILogger;
protected botDetailsCache: Record<string, IBotBase>;
constructor(logger: ILogger);
/**
* Store a bot in the cache, keyed by its name
* @param botToCache Bot details to cache
*/
cacheBot(botToCache: IBotBase): void;
/**
* Clean the cache of all bot details
*/
clearCache(): void;
/**
* Find a bot in the cache by its name
* @param botName Name of bot to find
* @returns Bot details
*/
getBotByName(botName: string): IBotBase;
}

View File

@ -1,38 +1,45 @@
import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { NotificationSendHelper } from "../helpers/NotificationSendHelper";
import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper";
import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcData } from "../models/eft/common/IPmcData";
import { Victim } from "../models/eft/common/tables/IBotBase"; import { Aggressor, Victim } from "../models/eft/common/tables/IBotBase";
import { IUserDialogInfo } from "../models/eft/profile/IAkiProfile"; import { IUserDialogInfo } from "../models/eft/profile/IAkiProfile";
import { IPmcChatResponse } from "../models/spt/config/IPmChatResponse"; import { IPmcChatResponse } from "../models/spt/config/IPmChatResponse";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { RandomUtil } from "../utils/RandomUtil"; import { RandomUtil } from "../utils/RandomUtil";
import { LocalisationService } from "./LocalisationService"; import { LocalisationService } from "./LocalisationService";
import { MatchBotDetailsCacheService } from "./MatchBotDetailsCacheService";
export declare class PmcChatResponseService { export declare class PmcChatResponseService {
protected logger: ILogger;
protected randomUtil: RandomUtil; protected randomUtil: RandomUtil;
protected notificationSendHelper: NotificationSendHelper; protected notificationSendHelper: NotificationSendHelper;
protected matchBotDetailsCacheService: MatchBotDetailsCacheService;
protected localisationService: LocalisationService; protected localisationService: LocalisationService;
protected weightedRandomHelper: WeightedRandomHelper; protected weightedRandomHelper: WeightedRandomHelper;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected pmcResponsesConfig: IPmcChatResponse; protected pmcResponsesConfig: IPmcChatResponse;
constructor(randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer);
/** /**
* Chooses a random victim from those provided and sends a message to the player, can be positive or negative * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative
* @param sessionId Session id * @param sessionId Session id
* @param pmcVictims Array of bots killed by player * @param pmcVictims Array of bots killed by player
* @param pmcData Player profile
*/ */
sendVictimResponse(sessionId: string, pmcVictims: Victim[]): void; sendVictimResponse(sessionId: string, pmcVictims: Victim[], pmcData: IPmcData): void;
/** /**
* Not fully implemented yet, needs method of acquiring killers details after raid * Not fully implemented yet, needs method of acquiring killers details after raid
* @param sessionId Session id * @param sessionId Session id
* @param pmcData Players profile * @param pmcData Players profile
* @param killer The bot who killed the player
*/ */
sendKillerResponse(sessionId: string, pmcData: IPmcData): void; sendKillerResponse(sessionId: string, pmcData: IPmcData, killer: Aggressor): void;
/** /**
* Choose a localised message to send the player (different if sender was killed or killed player) * Choose a localised message to send the player (different if sender was killed or killed player)
* @param isVictim * @param isVictim Is the message coming from a bot killed by the player
* @returns * @param pmcData Player profile
* @returns Message from PMC to player
*/ */
protected chooseMessage(isVictim: boolean): string; protected chooseMessage(isVictim: boolean, pmcData: IPmcData): string;
/** /**
* Should capitalisation be stripped from the message response before sending * Should capitalisation be stripped from the message response before sending
* @param isVictim Was responder a victim of player * @param isVictim Was responder a victim of player
@ -46,11 +53,11 @@ export declare class PmcChatResponseService {
*/ */
protected allCaps(isVictim: boolean): boolean; protected allCaps(isVictim: boolean): boolean;
/** /**
* Should the word 'bro' be appended to the message being sent to player * Should a suffix be appended to the end of the message being sent to player
* @param isVictim Was responder a victim of player * @param isVictim Was responder a victim of player
* @returns true = should be stripped * @returns true = should be stripped
*/ */
appendBroToMessageEnd(isVictim: boolean): boolean; appendSuffixToMessageEnd(isVictim: boolean): boolean;
/** /**
* Choose a type of response based on the weightings in pmc response config * Choose a type of response based on the weightings in pmc response config
* @param isVictim Was responder killed by player * @param isVictim Was responder killed by player
@ -64,10 +71,21 @@ export declare class PmcChatResponseService {
* @returns * @returns
*/ */
protected getResponseLocaleKeys(keyType: string, isVictim?: boolean): string[]; protected getResponseLocaleKeys(keyType: string, isVictim?: boolean): string[];
/**
* Get all locale keys that start with `pmcresponse-suffix`
* @returns array of keys
*/
protected getResponseSuffixLocaleKeys(): string[];
/** /**
* Randomly draw a victim of the the array and return thier details * Randomly draw a victim of the the array and return thier details
* @param pmcVictims Possible victims to choose from * @param pmcVictims Possible victims to choose from
* @returns IUserDialogInfo * @returns IUserDialogInfo
*/ */
protected chooseRandomVictim(pmcVictims: Victim[]): IUserDialogInfo; protected chooseRandomVictim(pmcVictims: Victim[]): IUserDialogInfo;
/**
* Convert a victim object into a IUserDialogInfo object
* @param pmcVictim victim to convert
* @returns IUserDialogInfo
*/
protected getVictimDetails(pmcVictim: Victim): IUserDialogInfo;
} }

View File

@ -13,6 +13,7 @@ import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService";
import { LocalisationService } from "../services/LocalisationService"; import { LocalisationService } from "../services/LocalisationService";
import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService";
import { JsonUtil } from "../utils/JsonUtil"; import { JsonUtil } from "../utils/JsonUtil";
export declare class BotController { export declare class BotController {
protected logger: ILogger; protected logger: ILogger;
@ -21,6 +22,7 @@ export declare class BotController {
protected botHelper: BotHelper; protected botHelper: BotHelper;
protected botDifficultyHelper: BotDifficultyHelper; protected botDifficultyHelper: BotDifficultyHelper;
protected botGenerationCacheService: BotGenerationCacheService; protected botGenerationCacheService: BotGenerationCacheService;
protected matchBotDetailsCacheService: MatchBotDetailsCacheService;
protected localisationService: LocalisationService; protected localisationService: LocalisationService;
protected profileHelper: ProfileHelper; protected profileHelper: ProfileHelper;
protected configServer: ConfigServer; protected configServer: ConfigServer;
@ -28,7 +30,7 @@ export declare class BotController {
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected botConfig: IBotConfig; protected botConfig: IBotConfig;
static readonly pmcTypeLabel = "PMC"; static readonly pmcTypeLabel = "PMC";
constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil);
/** /**
* Return the number of bot loadout varieties to be generated * Return the number of bot loadout varieties to be generated
* @param type bot Type we want the loadout gen count for * @param type bot Type we want the loadout gen count for

View File

@ -43,6 +43,11 @@ export declare class GameController {
protected locationConfig: ILocationConfig; protected locationConfig: ILocationConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer); constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer);
gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void;
/**
* Players set botReload to a high value and don't expect the crazy fast reload speeds, give them a warn about it
* @param pmcProfile Player profile
*/
protected warnOnActiveBotReloadSkill(pmcProfile: IPmcData): void;
/** /**
* When player logs in, iterate over all active effects and reduce timer * When player logs in, iterate over all active effects and reduce timer
* TODO - add body part HP regen * TODO - add body part HP regen

View File

@ -19,6 +19,7 @@ import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { InsuranceService } from "../services/InsuranceService"; import { InsuranceService } from "../services/InsuranceService";
import { LocaleService } from "../services/LocaleService"; import { LocaleService } from "../services/LocaleService";
import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService";
import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { PmcChatResponseService } from "../services/PmcChatResponseService";
import { JsonUtil } from "../utils/JsonUtil"; import { JsonUtil } from "../utils/JsonUtil";
import { TimeUtil } from "../utils/TimeUtil"; import { TimeUtil } from "../utils/TimeUtil";
@ -33,6 +34,7 @@ export declare class InraidController {
protected databaseServer: DatabaseServer; protected databaseServer: DatabaseServer;
protected localeService: LocaleService; protected localeService: LocaleService;
protected pmcChatResponseService: PmcChatResponseService; protected pmcChatResponseService: PmcChatResponseService;
protected matchBotDetailsCacheService: MatchBotDetailsCacheService;
protected questHelper: QuestHelper; protected questHelper: QuestHelper;
protected itemHelper: ItemHelper; protected itemHelper: ItemHelper;
protected profileHelper: ProfileHelper; protected profileHelper: ProfileHelper;
@ -46,7 +48,7 @@ export declare class InraidController {
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected airdropConfig: IAirdropConfig; protected airdropConfig: IAirdropConfig;
protected inraidConfig: IInRaidConfig; protected inraidConfig: IInRaidConfig;
constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer);
/** /**
* Save locationId to active profiles inraid object AND app context * Save locationId to active profiles inraid object AND app context
* @param sessionID Session id * @param sessionID Session id

View File

@ -3,20 +3,28 @@ import { IChangeRequestData } from "../models/eft/launcher/IChangeRequestData";
import { ILoginRequestData } from "../models/eft/launcher/ILoginRequestData"; import { ILoginRequestData } from "../models/eft/launcher/ILoginRequestData";
import { IRegisterData } from "../models/eft/launcher/IRegisterData"; import { IRegisterData } from "../models/eft/launcher/IRegisterData";
import { Info } from "../models/eft/profile/IAkiProfile"; import { Info } from "../models/eft/profile/IAkiProfile";
import { IConnectResponse } from "../models/eft/profile/IConnectResponse";
import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ICoreConfig } from "../models/spt/config/ICoreConfig";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { LocalisationService } from "../services/LocalisationService";
import { HashUtil } from "../utils/HashUtil"; import { HashUtil } from "../utils/HashUtil";
export declare class LauncherController { export declare class LauncherController {
protected hashUtil: HashUtil; protected hashUtil: HashUtil;
protected saveServer: SaveServer; protected saveServer: SaveServer;
protected httpServerHelper: HttpServerHelper; protected httpServerHelper: HttpServerHelper;
protected databaseServer: DatabaseServer; protected databaseServer: DatabaseServer;
protected localisationService: LocalisationService;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected coreConfig: ICoreConfig; protected coreConfig: ICoreConfig;
constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, configServer: ConfigServer); constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer);
connect(): any; connect(): IConnectResponse;
/**
* Get descriptive text for each of the profile edtions a player can choose
* @returns
*/
protected getProfileDescriptions(): Record<string, string>;
find(sessionIdKey: string): Info; find(sessionIdKey: string): Info;
login(info: ILoginRequestData): string; login(info: ILoginRequestData): string;
register(info: IRegisterData): string; register(info: IRegisterData): string;

View File

@ -1,9 +1,12 @@
import { LocationGenerator } from "../generators/LocationGenerator"; import { LocationGenerator } from "../generators/LocationGenerator";
import { LootGenerator } from "../generators/LootGenerator"; import { LootGenerator } from "../generators/LootGenerator";
import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper";
import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationBase } from "../models/eft/common/ILocationBase";
import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase";
import { AirdropTypeEnum } from "../models/enums/AirdropType";
import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig";
import { LootItem } from "../models/spt/services/LootItem"; import { LootItem } from "../models/spt/services/LootItem";
import { LootRequest } from "../models/spt/services/LootRequest";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
@ -14,6 +17,7 @@ import { TimeUtil } from "../utils/TimeUtil";
export declare class LocationController { export declare class LocationController {
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected hashUtil: HashUtil; protected hashUtil: HashUtil;
protected weightedRandomHelper: WeightedRandomHelper;
protected logger: ILogger; protected logger: ILogger;
protected locationGenerator: LocationGenerator; protected locationGenerator: LocationGenerator;
protected localisationService: LocalisationService; protected localisationService: LocalisationService;
@ -22,14 +26,29 @@ export declare class LocationController {
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected airdropConfig: IAirdropConfig; protected airdropConfig: IAirdropConfig;
constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer);
get(location: string): ILocationBase; get(location: string): ILocationBase;
generate(name: string): ILocationBase; generate(name: string): ILocationBase;
/**
* Get all maps base location properties without loot data
* @returns ILocationsGenerateAllResponse
*/
generateAll(): ILocationsGenerateAllResponse; generateAll(): ILocationsGenerateAllResponse;
/** /**
* Get loot for an airdop container * Get loot for an airdop container
* Generates it randomly based on config/airdrop.json values * Generates it randomly based on config/airdrop.json values
* @returns Array of LootItem * @returns Array of LootItem objects
*/ */
getAirdropLoot(): LootItem[]; getAirdropLoot(): LootItem[];
/**
* Randomly pick a type of airdrop loot using weighted values from config
* @returns airdrop type value
*/
protected chooseAirdropType(): AirdropTypeEnum;
/**
* Get the configuration for a specific type of airdrop
* @param airdropType Type of airdrop to get settings for
* @returns LootRequest
*/
protected getAirdropLootConfigByType(airdropType: AirdropTypeEnum): LootRequest;
} }

View File

@ -4,7 +4,8 @@ import { ProfileHelper } from "../helpers/ProfileHelper";
import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; import { QuestConditionHelper } from "../helpers/QuestConditionHelper";
import { QuestHelper } from "../helpers/QuestHelper"; import { QuestHelper } from "../helpers/QuestHelper";
import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcData } from "../models/eft/common/IPmcData";
import { IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { Item } from "../models/eft/common/tables/IItem";
import { AvailableForConditions, IQuest, Reward } from "../models/eft/common/tables/IQuest";
import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests";
import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse";
import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData";
@ -46,10 +47,10 @@ export declare class QuestController {
getClientQuests(sessionID: string): IQuest[]; getClientQuests(sessionID: string): IQuest[];
/** /**
* Is the quest for the opposite side the player is on * Is the quest for the opposite side the player is on
* @param side player side (usec/bear) * @param playerSide Player side (usec/bear)
* @param questId questId to check * @param questId QuestId to check
*/ */
protected questIsForOtherSide(side: string, questId: string): boolean; protected questIsForOtherSide(playerSide: string, questId: string): boolean;
/** /**
* Handle the client accepting a quest and starting it * Handle the client accepting a quest and starting it
* Send starting rewards if any to player and * Send starting rewards if any to player and
@ -124,6 +125,22 @@ export declare class QuestController {
* @returns IItemEventRouterResponse * @returns IItemEventRouterResponse
*/ */
handoverQuest(pmcData: IPmcData, handoverQuestRequest: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; handoverQuest(pmcData: IPmcData, handoverQuestRequest: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse;
/**
* Show warning to user and write to log that repeatable quest failed a condition check
* @param handoverQuestRequest Quest request
* @param output Response to send to user
* @returns IItemEventRouterResponse
*/
protected showRepeatableQuestInvalidConditionError(handoverQuestRequest: IHandoverQuestRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse;
/**
* Show warning to user and write to log quest item handed over did not match what is required
* @param handoverQuestRequest Quest request
* @param itemHandedOver Non-matching item found
* @param handoverRequirements Quest handover requirements
* @param output Response to send to user
* @returns IItemEventRouterResponse
*/
protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse;
/** /**
* Increment a backend counter stored value by an amount, * Increment a backend counter stored value by an amount,
* Create counter if it does not exist * Create counter if it does not exist

View File

@ -96,7 +96,7 @@ export declare class BotEquipmentModGenerator {
*/ */
protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot;
/** /**
* randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * Randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot
* never return true for an item that has 0% spawn chance * never return true for an item that has 0% spawn chance
* @param itemSlot slot the item sits in * @param itemSlot slot the item sits in
* @param modSlot slot the mod sits in * @param modSlot slot the mod sits in

View File

@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper";
import { BotHelper } from "../helpers/BotHelper"; import { BotHelper } from "../helpers/BotHelper";
import { ProfileHelper } from "../helpers/ProfileHelper"; import { ProfileHelper } from "../helpers/ProfileHelper";
import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper";
import { Health as PmcHealth, IBotBase, Info, Skills } from "../models/eft/common/tables/IBotBase"; import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase";
import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { Health, IBotType } from "../models/eft/common/tables/IBotType";
import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails";
import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IBotConfig } from "../models/spt/config/IBotConfig";
@ -84,7 +84,18 @@ export declare class BotGenerator {
* @returns PmcHealth object * @returns PmcHealth object
*/ */
protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth;
protected generateSkills(skillsObj: Skills): Skills; /**
* Get a bots skills with randomsied progress value between the min and max values
* @param botSkills Skills that should have their progress value randomised
* @returns
*/
protected generateSkills(botSkills: IBaseJsonSkills): botSkills;
/**
* Randomise the progress value of passed in skills based on the min/max value
* @param skills Skills to randomise
* @returns Skills with randomised progress values as an array
*/
protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[];
/** /**
* Generate a random Id for a bot and apply to bots _id and aid value * Generate a random Id for a bot and apply to bots _id and aid value
* @param bot bot to update * @param bot bot to update

View File

@ -34,7 +34,7 @@ export declare class BotInventoryGenerator {
/** /**
* Add equipment/weapons/loot to bot * Add equipment/weapons/loot to bot
* @param sessionId Session id * @param sessionId Session id
* @param botJsonTemplate bot/x.json data from db * @param botJsonTemplate Base json db file for the bot having its loot generated
* @param botRole Role bot has (assault/pmcBot) * @param botRole Role bot has (assault/pmcBot)
* @param isPmc Is bot being converted into a pmc * @param isPmc Is bot being converted into a pmc
* @param botLevel Level of bot being generated * @param botLevel Level of bot being generated

View File

@ -3,7 +3,7 @@ import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper";
import { HandbookHelper } from "../helpers/HandbookHelper"; import { HandbookHelper } from "../helpers/HandbookHelper";
import { ItemHelper } from "../helpers/ItemHelper"; import { ItemHelper } from "../helpers/ItemHelper";
import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase";
import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; import { IBotType, Inventory, ModsChances } from "../models/eft/common/tables/IBotType";
import { Item } from "../models/eft/common/tables/IItem"; import { Item } from "../models/eft/common/tables/IItem";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IBotConfig } from "../models/spt/config/IBotConfig";
@ -33,15 +33,13 @@ export declare class BotLootGenerator {
/** /**
* Add loot to bots containers * Add loot to bots containers
* @param sessionId Session id * @param sessionId Session id
* @param templateInventory x.json from database/bots * @param botJsonTemplate Base json db file for the bot having its loot generated
* @param itemCounts Liits on item types to be added as loot
* @param isPmc Will bot be a pmc * @param isPmc Will bot be a pmc
* @param botRole Role of bot, e.g. asssult * @param botRole Role of bot, e.g. asssult
* @param botInventory Inventory to add loot to * @param botInventory Inventory to add loot to
* @param equipmentChances
* @param botLevel Level of bot * @param botLevel Level of bot
*/ */
generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; generateLoot(sessionId: string, botJsonTemplate: IBotType, isPmc: boolean, botRole: string, botInventory: PmcInventory, botLevel: number): void;
protected getRandomisedCount(min: number, max: number, nValue: number): number; protected getRandomisedCount(min: number, max: number, nValue: number): number;
/** /**
* Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached

View File

@ -23,7 +23,7 @@ export declare class LootGenerator {
* @param options parameters to adjust how loot is generated * @param options parameters to adjust how loot is generated
* @returns An array of loot items * @returns An array of loot items
*/ */
createRandomloot(options: LootRequest): LootItem[]; createRandomLoot(options: LootRequest): LootItem[];
/** /**
* Construct item limit record to hold max and current item count * Construct item limit record to hold max and current item count
* @param limits limits as defined in config * @param limits limits as defined in config

View File

@ -31,7 +31,7 @@ export declare class PMCLootGenerator {
*/ */
generatePMCVestLootPool(): string[]; generatePMCVestLootPool(): string[];
/** /**
* Check if item has a width/hide that lets it fit into a 1x2 slot * Check if item has a width/height that lets it fit into a 1x2/2x1 slot
* 1x1 / 1x2 / 2x1 * 1x1 / 1x2 / 2x1
* @param item Item to check size of * @param item Item to check size of
* @returns true if it fits * @returns true if it fits

View File

@ -171,17 +171,19 @@ declare class ItemHelper {
*/ */
isItemTplStackable(tpl: string): boolean; isItemTplStackable(tpl: string): boolean;
/** /**
* split item stack if it exceeds StackMaxSize * split item stack if it exceeds its StackMaxSize property
* @param itemToSplit item being split into smaller stacks
* @returns Array of split items
*/ */
splitStack(item: Item): Item[]; splitStack(itemToSplit: Item): Item[];
/** /**
* Find Barter items in the inventory * Find Barter items in the inventory
* @param {string} by * @param {string} by tpl or id
* @param {Object} pmcData * @param {Object} pmcData
* @param {string} barterItemId * @param {string} barterItemId
* @returns Array of Item objects * @returns Array of Item objects
*/ */
findBarterItems(by: string, pmcData: IPmcData, barterItemId: string): Item[]; findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[];
/** /**
* *
* @param pmcData * @param pmcData

View File

@ -1,6 +1,11 @@
import { IInventoryConfig } from "../models/spt/config/IInventoryConfig";
import { ConfigServer } from "../servers/ConfigServer";
export declare class PaymentHelper { export declare class PaymentHelper {
protected configServer: ConfigServer;
protected inventoryConfig: IInventoryConfig;
constructor(configServer: ConfigServer);
/** /**
* Check whether tpl is Money * Is the passed in tpl money (also checks custom currencies in inventoryConfig.customMoneyTpls)
* @param {string} tpl * @param {string} tpl
* @returns void * @returns void
*/ */

View File

@ -1,5 +1,6 @@
import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcData } from "../models/eft/common/IPmcData";
import { Quest } from "../models/eft/common/tables/IBotBase"; import { Quest } from "../models/eft/common/tables/IBotBase";
import { Item } from "../models/eft/common/tables/IItem";
import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "../models/eft/common/tables/IQuest";
import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse";
import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData";
@ -42,10 +43,10 @@ export declare class QuestHelper {
/** /**
* Get status of a quest in player profile by its id * Get status of a quest in player profile by its id
* @param pmcData Profile to search * @param pmcData Profile to search
* @param questID Quest id to look up * @param questId Quest id to look up
* @returns QuestStatus enum * @returns QuestStatus enum
*/ */
getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus; getQuestStatus(pmcData: IPmcData, questId: string): QuestStatus;
/** /**
* returns true is the level condition is satisfied * returns true is the level condition is satisfied
* @param playerLevel Players level * @param playerLevel Players level
@ -81,14 +82,19 @@ export declare class QuestHelper {
* @returns true if loyalty is high enough to fulfill quest requirement * @returns true if loyalty is high enough to fulfill quest requirement
*/ */
traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean;
/**
* take reward item from quest and set FiR status + fix stack sizes + fix mod Ids
* @param reward Reward item to fix
* @returns Fixed rewards
*/
protected processReward(reward: Reward): Reward[]; protected processReward(reward: Reward): Reward[];
/** /**
* Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success)
* @param quest quest to get rewards for * @param quest quest to get rewards for
* @param state Quest status that holds the items (Started, Success, Fail) * @param status Quest status that holds the items (Started, Success, Fail)
* @returns array of items with the correct maxStack * @returns array of items with the correct maxStack
*/ */
getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[];
/** /**
* Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile
* @param pmcData Player profile * @param pmcData Player profile
@ -97,19 +103,19 @@ export declare class QuestHelper {
*/ */
getQuestReadyForProfile(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): Quest; getQuestReadyForProfile(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): Quest;
/** /**
* TODO: what is going on here * Get quests that can be shown to player after starting a quest
* @param acceptedQuestId Quest to add to profile * @param startedQuestId Quest started by player
* @param sessionID Session id * @param sessionID Session id
* @returns Array of quests in profile + quest passed in as param * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started
*/ */
acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[];
/** /**
* TODO: what is going on here * Get quests that can be shown to player after failing a quest
* @param failedQuestId * @param failedQuestId Id of the quest failed by player
* @param sessionID Session id * @param sessionId Session id
* @returns * @returns
*/ */
failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; failedUnlocked(failedQuestId: string, sessionId: string): IQuest[];
/** /**
* Adjust quest money rewards by passed in multiplier * Adjust quest money rewards by passed in multiplier
* @param quest Quest to multiple money rewards * @param quest Quest to multiple money rewards
@ -127,6 +133,13 @@ export declare class QuestHelper {
* @param output ItemEvent router response * @param output ItemEvent router response
*/ */
changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void;
/**
* Add item stack change object into output route event response
* @param output Response to add item change event into
* @param sessionId Session id
* @param item Item that was adjusted
*/
protected addItemStackSizeChangeIntoEventResponse(output: IItemEventRouterResponse, sessionId: string, item: Item): void;
/** /**
* Get quests, strip all requirement conditions except level * Get quests, strip all requirement conditions except level
* @param quests quests to process * @param quests quests to process

View File

@ -8,8 +8,10 @@ import { SaveServer } from "../servers/SaveServer";
import { FenceService } from "../services/FenceService"; import { FenceService } from "../services/FenceService";
import { LocalisationService } from "../services/LocalisationService"; import { LocalisationService } from "../services/LocalisationService";
import { PlayerService } from "../services/PlayerService"; import { PlayerService } from "../services/PlayerService";
import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil"; import { TimeUtil } from "../utils/TimeUtil";
import { HandbookHelper } from "./HandbookHelper"; import { HandbookHelper } from "./HandbookHelper";
import { ItemHelper } from "./ItemHelper";
import { ProfileHelper } from "./ProfileHelper"; import { ProfileHelper } from "./ProfileHelper";
export declare class TraderHelper { export declare class TraderHelper {
protected logger: ILogger; protected logger: ILogger;
@ -17,15 +19,19 @@ export declare class TraderHelper {
protected saveServer: SaveServer; protected saveServer: SaveServer;
protected profileHelper: ProfileHelper; protected profileHelper: ProfileHelper;
protected handbookHelper: HandbookHelper; protected handbookHelper: HandbookHelper;
protected itemHelper: ItemHelper;
protected playerService: PlayerService; protected playerService: PlayerService;
protected localisationService: LocalisationService; protected localisationService: LocalisationService;
protected fenceService: FenceService; protected fenceService: FenceService;
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
protected randomUtil: RandomUtil;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected traderConfig: ITraderConfig; protected traderConfig: ITraderConfig;
/** Dictionary of item tpl and the highest trader rouble price */ /** Dictionary of item tpl and the highest trader sell rouble price */
protected highestTraderPriceItems: Record<string, number>; protected highestTraderPriceItems: Record<string, number>;
constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); /** Dictionary of item tpl and the highest trader buy back rouble price */
protected highestTraderBuyPriceItems: Record<string, number>;
constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer);
getTrader(traderID: string, sessionID: string): ITraderBase; getTrader(traderID: string, sessionID: string): ITraderBase;
getTraderAssortsById(traderId: string): ITraderAssort; getTraderAssortsById(traderId: string): ITraderAssort;
/** /**
@ -82,8 +88,15 @@ export declare class TraderHelper {
}): void; }): void;
/** /**
* Get the highest rouble price for an item from traders * Get the highest rouble price for an item from traders
* UNUSED
* @param tpl Item to look up highest pride for * @param tpl Item to look up highest pride for
* @returns highest rouble cost for item * @returns highest rouble cost for item
*/ */
getHighestTraderPriceRouble(tpl: string): number; getHighestTraderPriceRouble(tpl: string): number;
/**
* Get the highest price item can be sold to trader for (roubles)
* @param tpl Item to look up best trader sell-to price
* @returns Rouble price
*/
getHighestSellToTraderPrice(tpl: string): number;
} }

View File

@ -1,5 +1,6 @@
export declare class WeightedRandomHelper { export declare class WeightedRandomHelper {
/** /**
* USE getWeightedValue() WHERE POSSIBLE
* Gets a tplId from a weighted dictionary * Gets a tplId from a weighted dictionary
* @param {tplId: weighting[]} itemArray * @param {tplId: weighting[]} itemArray
* @returns tplId * @returns tplId
@ -7,6 +8,9 @@ export declare class WeightedRandomHelper {
getWeightedInventoryItem(itemArray: { getWeightedInventoryItem(itemArray: {
[tplId: string]: unknown; [tplId: string]: unknown;
} | ArrayLike<unknown>): string; } | ArrayLike<unknown>): string;
getWeightedValue<T>(itemArray: {
[key: string]: unknown;
} | ArrayLike<unknown>): T;
/** /**
* Picks the random item based on its weight. * Picks the random item based on its weight.
* The items with higher weight will be picked more often (with a higher probability). * The items with higher weight will be picked more often (with a higher probability).

View File

@ -122,24 +122,27 @@ export interface Inventory {
questStashItems: string; questStashItems: string;
fastPanel: Record<string, string>; fastPanel: Record<string, string>;
} }
export interface IBaseJsonSkills {
Common: Record<string, Common>;
Mastering: Record<string, Mastering>;
Points: number;
}
export interface Skills { export interface Skills {
Common: Common[]; Common: Common[];
Mastering: Mastering[]; Mastering: Mastering[];
Points: number; Points: number;
} }
export interface Common { export interface IBaseSkill {
Id: string; Id: string;
Progress: number; Progress: number;
PointsEarnedDuringSession?: number;
LastAccess?: number;
max?: number; max?: number;
min?: number; min?: number;
} }
export interface Mastering { export interface Common extends IBaseSkill {
Id: string; PointsEarnedDuringSession?: number;
Progress: number; LastAccess?: number;
max?: number; }
min?: number; export interface Mastering extends IBaseSkill {
} }
export interface Stats { export interface Stats {
CarriedQuestItems: string[]; CarriedQuestItems: string[];

View File

@ -104,13 +104,17 @@ export interface Generation {
items: ItemMinMax; items: ItemMinMax;
} }
export interface ItemMinMax { export interface ItemMinMax {
grenades: MinMax; grenades: MinMaxWithWhitelist;
healing: MinMax; healing: MinMaxWithWhitelist;
drugs: MinMax; drugs: MinMaxWithWhitelist;
stims: MinMax; stims: MinMaxWithWhitelist;
looseLoot: MinMax; looseLoot: MinMaxWithWhitelist;
magazines: MinMax; magazines: MinMaxWithWhitelist;
specialItems: MinMax; specialItems: MinMaxWithWhitelist;
}
export interface MinMaxWithWhitelist extends MinMax {
/** Array of item tpls */
whitelist: string[];
} }
export interface Health { export interface Health {
BodyParts: BodyPart[]; BodyParts: BodyPart[];

View File

@ -0,0 +1,6 @@
export interface IConnectResponse {
backendUrl: string;
name: string;
editions: string[];
profileDescriptions: Record<string, string>;
}

View File

@ -0,0 +1,6 @@
export declare enum AirdropTypeEnum {
MIXED = "mixed",
WEAPONARMOR = "weaponarmor",
FOODMEDICAL = "foodmedical",
BARTER = "barter"
}

View File

@ -28,6 +28,6 @@ export declare enum WildSpawnTypeNumber {
BOSSKNIGHT = 67108864, BOSSKNIGHT = 67108864,
FOLLOWERBIGPIPE = 134217728, FOLLOWERBIGPIPE = 134217728,
FOLLOWERBIRDEYE = 268435456, FOLLOWERBIRDEYE = 268435456,
SPTUSEC = 536870912, BOSSZRYACHIY = 536870912,
SPTBEAR = 1073741824 FOLLOWERZRYACHIY = 1073741824
} }

View File

@ -1,5 +1,5 @@
import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; import { ITemplateItem } from "../../eft/common/tables/ITemplateItem";
export declare class BotLootCache { export interface IBotLootCache {
backpackLoot: ITemplateItem[]; backpackLoot: ITemplateItem[];
pocketLoot: ITemplateItem[]; pocketLoot: ITemplateItem[];
vestLoot: ITemplateItem[]; vestLoot: ITemplateItem[];

View File

@ -1,8 +1,10 @@
import { AirdropTypeEnum } from "../../../models/enums/AirdropType";
import { MinMax } from "../../common/MinMax"; import { MinMax } from "../../common/MinMax";
import { IBaseConfig } from "./IBaseConfig"; import { IBaseConfig } from "./IBaseConfig";
export interface IAirdropConfig extends IBaseConfig { export interface IAirdropConfig extends IBaseConfig {
kind: "aki-airdrop"; kind: "aki-airdrop";
airdropChancePercent: AirdropChancePercent; airdropChancePercent: AirdropChancePercent;
airdropTypeWeightings: Record<AirdropTypeEnum, number>;
planeMinFlyHeight: number; planeMinFlyHeight: number;
planeMaxFlyHeight: number; planeMaxFlyHeight: number;
planeVolume: number; planeVolume: number;
@ -10,7 +12,7 @@ export interface IAirdropConfig extends IBaseConfig {
crateFallSpeed: number; crateFallSpeed: number;
airdropMinStartTimeSeconds: number; airdropMinStartTimeSeconds: number;
airdropMaxStartTimeSeconds: number; airdropMaxStartTimeSeconds: number;
loot: AirdropLoot; loot: Record<string, AirdropLoot>;
} }
export interface AirdropChancePercent { export interface AirdropChancePercent {
bigmap: number; bigmap: number;
@ -22,12 +24,12 @@ export interface AirdropChancePercent {
tarkovStreets: number; tarkovStreets: number;
} }
export interface AirdropLoot { export interface AirdropLoot {
presetCount: MinMax; presetCount?: MinMax;
itemCount: MinMax; itemCount: MinMax;
itemBlacklist: string[]; itemBlacklist: string[];
itemTypeWhitelist: string[]; itemTypeWhitelist: string[];
/** key: item base type: value: max count */ /** key: item base type: value: max count */
itemLimits: Record<string, number>; itemLimits: Record<string, number>;
itemStackLimits: Record<string, MinMax>; itemStackLimits: Record<string, MinMax>;
armorLevelWhitelist: number[]; armorLevelWhitelist?: number[];
} }

View File

@ -1,3 +1,4 @@
import { MinMaxWithWhitelist } from "../../../models/eft/common/tables/IBotType";
import { MinMax } from "../../common/MinMax"; import { MinMax } from "../../common/MinMax";
import { IBaseConfig } from "./IBaseConfig"; import { IBaseConfig } from "./IBaseConfig";
import { IBotDurability } from "./IBotDurability"; import { IBotDurability } from "./IBotDurability";
@ -85,7 +86,7 @@ export interface ModLimits {
} }
export interface RandomisationDetails { export interface RandomisationDetails {
levelRange: MinMax; levelRange: MinMax;
generation?: Record<string, MinMax>; generation?: Record<string, MinMaxWithWhitelist>;
randomisedWeaponModSlots?: string[]; randomisedWeaponModSlots?: string[];
randomisedArmorSlots?: string[]; randomisedArmorSlots?: string[];
/** Equipment chances */ /** Equipment chances */

View File

@ -4,5 +4,6 @@ export interface ICoreConfig extends IBaseConfig {
akiVersion: string; akiVersion: string;
projectName: string; projectName: string;
compatibleTarkovVersion: string; compatibleTarkovVersion: string;
serverName: string;
commit: string; commit: string;
} }

View File

@ -3,6 +3,8 @@ export interface IInventoryConfig extends IBaseConfig {
kind: "aki-inventory"; kind: "aki-inventory";
newItemsMarkedFound: boolean; newItemsMarkedFound: boolean;
randomLootContainers: Record<string, RewardDetails>; randomLootContainers: Record<string, RewardDetails>;
/** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */
customMoneyTpls: string[];
} }
export interface RewardDetails { export interface RewardDetails {
rewardCount: number; rewardCount: number;

View File

@ -2,16 +2,24 @@ import { MinMax } from "../../common/MinMax";
import { IBaseConfig } from "./IBaseConfig"; import { IBaseConfig } from "./IBaseConfig";
export interface IRagfairConfig extends IBaseConfig { export interface IRagfairConfig extends IBaseConfig {
kind: "aki-ragfair"; kind: "aki-ragfair";
/** How many seconds should pass before expired offers and procesed + player offers checked if sold */
runIntervalSeconds: number; runIntervalSeconds: number;
/** Player listing settings */
sell: Sell; sell: Sell;
/** Trader ids + should their assorts be listed on flea*/
traders: Record<string, boolean>; traders: Record<string, boolean>;
dynamic: Dynamic; dynamic: Dynamic;
} }
export interface Sell { export interface Sell {
/** Should a fee be deducted from player when liting an item for sale */
fees: boolean; fees: boolean;
/** Settings to control chances of offer being sold */
chance: Chance; chance: Chance;
/** Settings to control how long it takes for a player offer to sell */
time: Time; time: Time;
/** Player offer reputation gain/loss settings */
reputation: Reputation; reputation: Reputation;
/** How many hours are simulated to figure out if player offer was sold */
simulatedSellHours: number; simulatedSellHours: number;
} }
export interface Chance { export interface Chance {
@ -32,48 +40,77 @@ export interface Dynamic {
purchasesAreFoundInRaid: boolean; purchasesAreFoundInRaid: boolean;
/** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */
useTraderPriceForOffersIfHigher: boolean; useTraderPriceForOffersIfHigher: boolean;
/** Barter offer specific settings */
barter: Barter; barter: Barter;
/** Dynamic offer price below handbook adjustment values */
offerAdjustment: OfferAdjustment; offerAdjustment: OfferAdjustment;
/** How many offers should expire before an offer regeneration occurs */
expiredOfferThreshold: number; expiredOfferThreshold: number;
/** How many offers should be listed */
offerItemCount: MinMax; offerItemCount: MinMax;
/** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */
price: MinMax; price: MinMax;
/** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */
presetPrice: MinMax; presetPrice: MinMax;
/** Should default presets to listed only or should non-standard presets found in globals.json be listed too */
showDefaultPresetsOnly: boolean; showDefaultPresetsOnly: boolean;
endTimeSeconds: MinMax; endTimeSeconds: MinMax;
/** Settings to control the durability range of item items listed on flea */
condition: Condition; condition: Condition;
/** Size stackable items should be listed for in percent of max stack size */
stackablePercent: MinMax; stackablePercent: MinMax;
/** Items that cannot be stacked can have multiples sold in one offer, what range of values can be listed */
nonStackableCount: MinMax; nonStackableCount: MinMax;
/** Range of rating offers for items being listed */
rating: MinMax; rating: MinMax;
/** Percentages to sell offers in each currency */
currencies: Record<string, number>; currencies: Record<string, number>;
/** Item tpls that should be forced to sell as a single item */
showAsSingleStack: string[]; showAsSingleStack: string[];
/** Should christmas/halloween items be removed from flea when not within the seasonal bounds */
removeSeasonalItemsWhenNotInEvent: boolean; removeSeasonalItemsWhenNotInEvent: boolean;
/** Flea blacklist settings */
blacklist: Blacklist; blacklist: Blacklist;
} }
export interface Barter { export interface Barter {
/** Should barter offers be generated */
enable: boolean; enable: boolean;
/** Percentage change an offer is listed as a barter */
chancePercent: number; chancePercent: number;
/** Min number of required items for a barter requirement */
itemCountMin: number; itemCountMin: number;
/** Max number of required items for a barter requirement */
itemCountMax: number; itemCountMax: number;
/** How much can the total price of requested items vary from the item offered */
priceRangeVariancePercent: number; priceRangeVariancePercent: number;
/** Min rouble price for an offer to be considered for turning into a barter */
minRoubleCostToBecomeBarter: number; minRoubleCostToBecomeBarter: number;
/** Item Tpls to never be turned into a barter */
itemTypeBlacklist: string[]; itemTypeBlacklist: string[];
} }
export interface OfferAdjustment { export interface OfferAdjustment {
/** Shuld offer price be adjusted when below handbook price */
adjustPriceWhenBelowHandbookPrice: boolean;
/** How big a percentage difference does price need to vary from handbook to be considered for adjustment */
maxPriceDifferenceBelowHandbookPercent: number; maxPriceDifferenceBelowHandbookPercent: number;
/** How much to multiply the handbook price to get the new price */
handbookPriceMultipier: number; handbookPriceMultipier: number;
/** What is the minimum rouble price to consider adjusting price of item */
priceThreshholdRub: number; priceThreshholdRub: number;
} }
export interface Condition { export interface Condition {
/** Percentage change durability is altered */
conditionChance: number; conditionChance: number;
min: number; min: number;
max: number; max: number;
} }
export interface Blacklist { export interface Blacklist {
/** /** Custom blacklist for item Tpls */
* show/hide trader items that are blacklisted by bsg
*/
traderItems: boolean;
custom: string[]; custom: string[];
/** BSG blacklist a large number of items from flea, true = use blacklist */
enableBsgList: boolean; enableBsgList: boolean;
/** Should quest items be blacklisted from flea */
enableQuestList: boolean; enableQuestList: boolean;
/** Should trader items that are blacklisted by bsg */
traderItems: boolean;
} }

View File

@ -1,5 +1,5 @@
import { MinMax } from "../../common/MinMax"; import { MinMax } from "../../common/MinMax";
export declare class LootRequest { export interface LootRequest {
presetCount: MinMax; presetCount: MinMax;
itemCount: MinMax; itemCount: MinMax;
itemBlacklist: string[]; itemBlacklist: string[];

View File

@ -1,6 +1,5 @@
import { BotHelper } from "../helpers/BotHelper"; import { BotHelper } from "../helpers/BotHelper";
import { MinMax } from "../models/common/MinMax"; import { EquipmentChances, Generation, IBotType, MinMaxWithWhitelist, ModsChances } from "../models/eft/common/tables/IBotType";
import { EquipmentChances, Generation, IBotType, ModsChances } from "../models/eft/common/tables/IBotType";
import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails";
import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
@ -30,7 +29,7 @@ export declare class BotEquipmentFilterService {
* @param generationChanges Changes to apply * @param generationChanges Changes to apply
* @param baseBotGeneration dictionary to update * @param baseBotGeneration dictionary to update
*/ */
protected adjustGenerationChances(generationChanges: Record<string, MinMax>, baseBotGeneration: Generation): void; protected adjustGenerationChances(generationChanges: Record<string, MinMaxWithWhitelist>, baseBotGeneration: Generation): void;
/** /**
* Get equipment settings for bot * Get equipment settings for bot
* @param botEquipmentRole equipment role to return * @param botEquipmentRole equipment role to return

View File

@ -1,7 +1,8 @@
import { PMCLootGenerator } from "../generators/PMCLootGenerator"; import { PMCLootGenerator } from "../generators/PMCLootGenerator";
import { Items } from "../models/eft/common/tables/IBotType"; import { ItemHelper } from "../helpers/ItemHelper";
import { IBotType } from "../models/eft/common/tables/IBotType";
import { ITemplateItem, Props } from "../models/eft/common/tables/ITemplateItem"; import { ITemplateItem, Props } from "../models/eft/common/tables/ITemplateItem";
import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; import { IBotLootCache, LootCacheType } from "../models/spt/bots/IBotLootCache";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { JsonUtil } from "../utils/JsonUtil"; import { JsonUtil } from "../utils/JsonUtil";
@ -10,12 +11,13 @@ import { RagfairPriceService } from "./RagfairPriceService";
export declare class BotLootCacheService { export declare class BotLootCacheService {
protected logger: ILogger; protected logger: ILogger;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected itemHelper: ItemHelper;
protected databaseServer: DatabaseServer; protected databaseServer: DatabaseServer;
protected pmcLootGenerator: PMCLootGenerator; protected pmcLootGenerator: PMCLootGenerator;
protected localisationService: LocalisationService; protected localisationService: LocalisationService;
protected ragfairPriceService: RagfairPriceService; protected ragfairPriceService: RagfairPriceService;
protected lootCache: Record<string, BotLootCache>; protected lootCache: Record<string, IBotLootCache>;
constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService);
/** /**
* Remove all cached bot loot data * Remove all cached bot loot data
*/ */
@ -25,17 +27,17 @@ export declare class BotLootCacheService {
* @param botRole bot to get loot for * @param botRole bot to get loot for
* @param isPmc is the bot a pmc * @param isPmc is the bot a pmc
* @param lootType what type of loot is needed (backpack/pocket/stim/vest etc) * @param lootType what type of loot is needed (backpack/pocket/stim/vest etc)
* @param lootPool the full pool of loot (needed when cache is empty) * @param botJsonTemplate Base json db file for the bot having its loot generated
* @returns ITemplateItem array * @returns ITemplateItem array
*/ */
getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, lootPool: Items): ITemplateItem[]; getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[];
/** /**
* Generate loot for a bot and store inside a private class property * Generate loot for a bot and store inside a private class property
* @param botRole bots role (assault / pmcBot etc) * @param botRole bots role (assault / pmcBot etc)
* @param lootPool the full pool of loot we use to create the various sub-categories with
* @param isPmc Is the bot a PMC (alteres what loot is cached) * @param isPmc Is the bot a PMC (alteres what loot is cached)
* @param botJsonTemplate db template for bot having its loot generated
*/ */
protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void;
/** /**
* Sort a pool of item objects by its flea price * Sort a pool of item objects by its flea price
* @param poolToSort pool of items to sort * @param poolToSort pool of items to sort

View File

@ -0,0 +1,23 @@
import { IBotBase } from "../models/eft/common/tables/IBotBase";
import { ILogger } from "../models/spt/utils/ILogger";
/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */
export declare class MatchBotDetailsCacheService {
protected logger: ILogger;
protected botDetailsCache: Record<string, IBotBase>;
constructor(logger: ILogger);
/**
* Store a bot in the cache, keyed by its name
* @param botToCache Bot details to cache
*/
cacheBot(botToCache: IBotBase): void;
/**
* Clean the cache of all bot details
*/
clearCache(): void;
/**
* Find a bot in the cache by its name
* @param botName Name of bot to find
* @returns Bot details
*/
getBotByName(botName: string): IBotBase;
}

View File

@ -1,38 +1,45 @@
import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { NotificationSendHelper } from "../helpers/NotificationSendHelper";
import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper";
import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcData } from "../models/eft/common/IPmcData";
import { Victim } from "../models/eft/common/tables/IBotBase"; import { Aggressor, Victim } from "../models/eft/common/tables/IBotBase";
import { IUserDialogInfo } from "../models/eft/profile/IAkiProfile"; import { IUserDialogInfo } from "../models/eft/profile/IAkiProfile";
import { IPmcChatResponse } from "../models/spt/config/IPmChatResponse"; import { IPmcChatResponse } from "../models/spt/config/IPmChatResponse";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { RandomUtil } from "../utils/RandomUtil"; import { RandomUtil } from "../utils/RandomUtil";
import { LocalisationService } from "./LocalisationService"; import { LocalisationService } from "./LocalisationService";
import { MatchBotDetailsCacheService } from "./MatchBotDetailsCacheService";
export declare class PmcChatResponseService { export declare class PmcChatResponseService {
protected logger: ILogger;
protected randomUtil: RandomUtil; protected randomUtil: RandomUtil;
protected notificationSendHelper: NotificationSendHelper; protected notificationSendHelper: NotificationSendHelper;
protected matchBotDetailsCacheService: MatchBotDetailsCacheService;
protected localisationService: LocalisationService; protected localisationService: LocalisationService;
protected weightedRandomHelper: WeightedRandomHelper; protected weightedRandomHelper: WeightedRandomHelper;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected pmcResponsesConfig: IPmcChatResponse; protected pmcResponsesConfig: IPmcChatResponse;
constructor(randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer);
/** /**
* Chooses a random victim from those provided and sends a message to the player, can be positive or negative * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative
* @param sessionId Session id * @param sessionId Session id
* @param pmcVictims Array of bots killed by player * @param pmcVictims Array of bots killed by player
* @param pmcData Player profile
*/ */
sendVictimResponse(sessionId: string, pmcVictims: Victim[]): void; sendVictimResponse(sessionId: string, pmcVictims: Victim[], pmcData: IPmcData): void;
/** /**
* Not fully implemented yet, needs method of acquiring killers details after raid * Not fully implemented yet, needs method of acquiring killers details after raid
* @param sessionId Session id * @param sessionId Session id
* @param pmcData Players profile * @param pmcData Players profile
* @param killer The bot who killed the player
*/ */
sendKillerResponse(sessionId: string, pmcData: IPmcData): void; sendKillerResponse(sessionId: string, pmcData: IPmcData, killer: Aggressor): void;
/** /**
* Choose a localised message to send the player (different if sender was killed or killed player) * Choose a localised message to send the player (different if sender was killed or killed player)
* @param isVictim * @param isVictim Is the message coming from a bot killed by the player
* @returns * @param pmcData Player profile
* @returns Message from PMC to player
*/ */
protected chooseMessage(isVictim: boolean): string; protected chooseMessage(isVictim: boolean, pmcData: IPmcData): string;
/** /**
* Should capitalisation be stripped from the message response before sending * Should capitalisation be stripped from the message response before sending
* @param isVictim Was responder a victim of player * @param isVictim Was responder a victim of player
@ -46,11 +53,11 @@ export declare class PmcChatResponseService {
*/ */
protected allCaps(isVictim: boolean): boolean; protected allCaps(isVictim: boolean): boolean;
/** /**
* Should the word 'bro' be appended to the message being sent to player * Should a suffix be appended to the end of the message being sent to player
* @param isVictim Was responder a victim of player * @param isVictim Was responder a victim of player
* @returns true = should be stripped * @returns true = should be stripped
*/ */
appendBroToMessageEnd(isVictim: boolean): boolean; appendSuffixToMessageEnd(isVictim: boolean): boolean;
/** /**
* Choose a type of response based on the weightings in pmc response config * Choose a type of response based on the weightings in pmc response config
* @param isVictim Was responder killed by player * @param isVictim Was responder killed by player
@ -64,10 +71,21 @@ export declare class PmcChatResponseService {
* @returns * @returns
*/ */
protected getResponseLocaleKeys(keyType: string, isVictim?: boolean): string[]; protected getResponseLocaleKeys(keyType: string, isVictim?: boolean): string[];
/**
* Get all locale keys that start with `pmcresponse-suffix`
* @returns array of keys
*/
protected getResponseSuffixLocaleKeys(): string[];
/** /**
* Randomly draw a victim of the the array and return thier details * Randomly draw a victim of the the array and return thier details
* @param pmcVictims Possible victims to choose from * @param pmcVictims Possible victims to choose from
* @returns IUserDialogInfo * @returns IUserDialogInfo
*/ */
protected chooseRandomVictim(pmcVictims: Victim[]): IUserDialogInfo; protected chooseRandomVictim(pmcVictims: Victim[]): IUserDialogInfo;
/**
* Convert a victim object into a IUserDialogInfo object
* @param pmcVictim victim to convert
* @returns IUserDialogInfo
*/
protected getVictimDetails(pmcVictim: Victim): IUserDialogInfo;
} }

View File

@ -13,6 +13,7 @@ import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService";
import { LocalisationService } from "../services/LocalisationService"; import { LocalisationService } from "../services/LocalisationService";
import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService";
import { JsonUtil } from "../utils/JsonUtil"; import { JsonUtil } from "../utils/JsonUtil";
export declare class BotController { export declare class BotController {
protected logger: ILogger; protected logger: ILogger;
@ -21,6 +22,7 @@ export declare class BotController {
protected botHelper: BotHelper; protected botHelper: BotHelper;
protected botDifficultyHelper: BotDifficultyHelper; protected botDifficultyHelper: BotDifficultyHelper;
protected botGenerationCacheService: BotGenerationCacheService; protected botGenerationCacheService: BotGenerationCacheService;
protected matchBotDetailsCacheService: MatchBotDetailsCacheService;
protected localisationService: LocalisationService; protected localisationService: LocalisationService;
protected profileHelper: ProfileHelper; protected profileHelper: ProfileHelper;
protected configServer: ConfigServer; protected configServer: ConfigServer;
@ -28,7 +30,7 @@ export declare class BotController {
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected botConfig: IBotConfig; protected botConfig: IBotConfig;
static readonly pmcTypeLabel = "PMC"; static readonly pmcTypeLabel = "PMC";
constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil);
/** /**
* Return the number of bot loadout varieties to be generated * Return the number of bot loadout varieties to be generated
* @param type bot Type we want the loadout gen count for * @param type bot Type we want the loadout gen count for

View File

@ -43,6 +43,11 @@ export declare class GameController {
protected locationConfig: ILocationConfig; protected locationConfig: ILocationConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer); constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer);
gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void;
/**
* Players set botReload to a high value and don't expect the crazy fast reload speeds, give them a warn about it
* @param pmcProfile Player profile
*/
protected warnOnActiveBotReloadSkill(pmcProfile: IPmcData): void;
/** /**
* When player logs in, iterate over all active effects and reduce timer * When player logs in, iterate over all active effects and reduce timer
* TODO - add body part HP regen * TODO - add body part HP regen

View File

@ -19,6 +19,7 @@ import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { InsuranceService } from "../services/InsuranceService"; import { InsuranceService } from "../services/InsuranceService";
import { LocaleService } from "../services/LocaleService"; import { LocaleService } from "../services/LocaleService";
import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService";
import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { PmcChatResponseService } from "../services/PmcChatResponseService";
import { JsonUtil } from "../utils/JsonUtil"; import { JsonUtil } from "../utils/JsonUtil";
import { TimeUtil } from "../utils/TimeUtil"; import { TimeUtil } from "../utils/TimeUtil";
@ -33,6 +34,7 @@ export declare class InraidController {
protected databaseServer: DatabaseServer; protected databaseServer: DatabaseServer;
protected localeService: LocaleService; protected localeService: LocaleService;
protected pmcChatResponseService: PmcChatResponseService; protected pmcChatResponseService: PmcChatResponseService;
protected matchBotDetailsCacheService: MatchBotDetailsCacheService;
protected questHelper: QuestHelper; protected questHelper: QuestHelper;
protected itemHelper: ItemHelper; protected itemHelper: ItemHelper;
protected profileHelper: ProfileHelper; protected profileHelper: ProfileHelper;
@ -46,7 +48,7 @@ export declare class InraidController {
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected airdropConfig: IAirdropConfig; protected airdropConfig: IAirdropConfig;
protected inraidConfig: IInRaidConfig; protected inraidConfig: IInRaidConfig;
constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer);
/** /**
* Save locationId to active profiles inraid object AND app context * Save locationId to active profiles inraid object AND app context
* @param sessionID Session id * @param sessionID Session id

View File

@ -3,20 +3,28 @@ import { IChangeRequestData } from "../models/eft/launcher/IChangeRequestData";
import { ILoginRequestData } from "../models/eft/launcher/ILoginRequestData"; import { ILoginRequestData } from "../models/eft/launcher/ILoginRequestData";
import { IRegisterData } from "../models/eft/launcher/IRegisterData"; import { IRegisterData } from "../models/eft/launcher/IRegisterData";
import { Info } from "../models/eft/profile/IAkiProfile"; import { Info } from "../models/eft/profile/IAkiProfile";
import { IConnectResponse } from "../models/eft/profile/IConnectResponse";
import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ICoreConfig } from "../models/spt/config/ICoreConfig";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { LocalisationService } from "../services/LocalisationService";
import { HashUtil } from "../utils/HashUtil"; import { HashUtil } from "../utils/HashUtil";
export declare class LauncherController { export declare class LauncherController {
protected hashUtil: HashUtil; protected hashUtil: HashUtil;
protected saveServer: SaveServer; protected saveServer: SaveServer;
protected httpServerHelper: HttpServerHelper; protected httpServerHelper: HttpServerHelper;
protected databaseServer: DatabaseServer; protected databaseServer: DatabaseServer;
protected localisationService: LocalisationService;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected coreConfig: ICoreConfig; protected coreConfig: ICoreConfig;
constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, configServer: ConfigServer); constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer);
connect(): any; connect(): IConnectResponse;
/**
* Get descriptive text for each of the profile edtions a player can choose
* @returns
*/
protected getProfileDescriptions(): Record<string, string>;
find(sessionIdKey: string): Info; find(sessionIdKey: string): Info;
login(info: ILoginRequestData): string; login(info: ILoginRequestData): string;
register(info: IRegisterData): string; register(info: IRegisterData): string;

View File

@ -1,9 +1,12 @@
import { LocationGenerator } from "../generators/LocationGenerator"; import { LocationGenerator } from "../generators/LocationGenerator";
import { LootGenerator } from "../generators/LootGenerator"; import { LootGenerator } from "../generators/LootGenerator";
import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper";
import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationBase } from "../models/eft/common/ILocationBase";
import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase";
import { AirdropTypeEnum } from "../models/enums/AirdropType";
import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig";
import { LootItem } from "../models/spt/services/LootItem"; import { LootItem } from "../models/spt/services/LootItem";
import { LootRequest } from "../models/spt/services/LootRequest";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
@ -14,6 +17,7 @@ import { TimeUtil } from "../utils/TimeUtil";
export declare class LocationController { export declare class LocationController {
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected hashUtil: HashUtil; protected hashUtil: HashUtil;
protected weightedRandomHelper: WeightedRandomHelper;
protected logger: ILogger; protected logger: ILogger;
protected locationGenerator: LocationGenerator; protected locationGenerator: LocationGenerator;
protected localisationService: LocalisationService; protected localisationService: LocalisationService;
@ -22,14 +26,29 @@ export declare class LocationController {
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected airdropConfig: IAirdropConfig; protected airdropConfig: IAirdropConfig;
constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer);
get(location: string): ILocationBase; get(location: string): ILocationBase;
generate(name: string): ILocationBase; generate(name: string): ILocationBase;
/**
* Get all maps base location properties without loot data
* @returns ILocationsGenerateAllResponse
*/
generateAll(): ILocationsGenerateAllResponse; generateAll(): ILocationsGenerateAllResponse;
/** /**
* Get loot for an airdop container * Get loot for an airdop container
* Generates it randomly based on config/airdrop.json values * Generates it randomly based on config/airdrop.json values
* @returns Array of LootItem * @returns Array of LootItem objects
*/ */
getAirdropLoot(): LootItem[]; getAirdropLoot(): LootItem[];
/**
* Randomly pick a type of airdrop loot using weighted values from config
* @returns airdrop type value
*/
protected chooseAirdropType(): AirdropTypeEnum;
/**
* Get the configuration for a specific type of airdrop
* @param airdropType Type of airdrop to get settings for
* @returns LootRequest
*/
protected getAirdropLootConfigByType(airdropType: AirdropTypeEnum): LootRequest;
} }

View File

@ -4,7 +4,8 @@ import { ProfileHelper } from "../helpers/ProfileHelper";
import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; import { QuestConditionHelper } from "../helpers/QuestConditionHelper";
import { QuestHelper } from "../helpers/QuestHelper"; import { QuestHelper } from "../helpers/QuestHelper";
import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcData } from "../models/eft/common/IPmcData";
import { IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { Item } from "../models/eft/common/tables/IItem";
import { AvailableForConditions, IQuest, Reward } from "../models/eft/common/tables/IQuest";
import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests";
import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse";
import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData";
@ -46,10 +47,10 @@ export declare class QuestController {
getClientQuests(sessionID: string): IQuest[]; getClientQuests(sessionID: string): IQuest[];
/** /**
* Is the quest for the opposite side the player is on * Is the quest for the opposite side the player is on
* @param side player side (usec/bear) * @param playerSide Player side (usec/bear)
* @param questId questId to check * @param questId QuestId to check
*/ */
protected questIsForOtherSide(side: string, questId: string): boolean; protected questIsForOtherSide(playerSide: string, questId: string): boolean;
/** /**
* Handle the client accepting a quest and starting it * Handle the client accepting a quest and starting it
* Send starting rewards if any to player and * Send starting rewards if any to player and
@ -124,6 +125,22 @@ export declare class QuestController {
* @returns IItemEventRouterResponse * @returns IItemEventRouterResponse
*/ */
handoverQuest(pmcData: IPmcData, handoverQuestRequest: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; handoverQuest(pmcData: IPmcData, handoverQuestRequest: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse;
/**
* Show warning to user and write to log that repeatable quest failed a condition check
* @param handoverQuestRequest Quest request
* @param output Response to send to user
* @returns IItemEventRouterResponse
*/
protected showRepeatableQuestInvalidConditionError(handoverQuestRequest: IHandoverQuestRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse;
/**
* Show warning to user and write to log quest item handed over did not match what is required
* @param handoverQuestRequest Quest request
* @param itemHandedOver Non-matching item found
* @param handoverRequirements Quest handover requirements
* @param output Response to send to user
* @returns IItemEventRouterResponse
*/
protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse;
/** /**
* Increment a backend counter stored value by an amount, * Increment a backend counter stored value by an amount,
* Create counter if it does not exist * Create counter if it does not exist

View File

@ -96,7 +96,7 @@ export declare class BotEquipmentModGenerator {
*/ */
protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot;
/** /**
* randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * Randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot
* never return true for an item that has 0% spawn chance * never return true for an item that has 0% spawn chance
* @param itemSlot slot the item sits in * @param itemSlot slot the item sits in
* @param modSlot slot the mod sits in * @param modSlot slot the mod sits in

View File

@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper";
import { BotHelper } from "../helpers/BotHelper"; import { BotHelper } from "../helpers/BotHelper";
import { ProfileHelper } from "../helpers/ProfileHelper"; import { ProfileHelper } from "../helpers/ProfileHelper";
import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper";
import { Health as PmcHealth, IBotBase, Info, Skills } from "../models/eft/common/tables/IBotBase"; import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase";
import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { Health, IBotType } from "../models/eft/common/tables/IBotType";
import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails";
import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IBotConfig } from "../models/spt/config/IBotConfig";
@ -84,7 +84,18 @@ export declare class BotGenerator {
* @returns PmcHealth object * @returns PmcHealth object
*/ */
protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth;
protected generateSkills(skillsObj: Skills): Skills; /**
* Get a bots skills with randomsied progress value between the min and max values
* @param botSkills Skills that should have their progress value randomised
* @returns
*/
protected generateSkills(botSkills: IBaseJsonSkills): botSkills;
/**
* Randomise the progress value of passed in skills based on the min/max value
* @param skills Skills to randomise
* @returns Skills with randomised progress values as an array
*/
protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[];
/** /**
* Generate a random Id for a bot and apply to bots _id and aid value * Generate a random Id for a bot and apply to bots _id and aid value
* @param bot bot to update * @param bot bot to update

View File

@ -34,7 +34,7 @@ export declare class BotInventoryGenerator {
/** /**
* Add equipment/weapons/loot to bot * Add equipment/weapons/loot to bot
* @param sessionId Session id * @param sessionId Session id
* @param botJsonTemplate bot/x.json data from db * @param botJsonTemplate Base json db file for the bot having its loot generated
* @param botRole Role bot has (assault/pmcBot) * @param botRole Role bot has (assault/pmcBot)
* @param isPmc Is bot being converted into a pmc * @param isPmc Is bot being converted into a pmc
* @param botLevel Level of bot being generated * @param botLevel Level of bot being generated

View File

@ -3,7 +3,7 @@ import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper";
import { HandbookHelper } from "../helpers/HandbookHelper"; import { HandbookHelper } from "../helpers/HandbookHelper";
import { ItemHelper } from "../helpers/ItemHelper"; import { ItemHelper } from "../helpers/ItemHelper";
import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase";
import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; import { IBotType, Inventory, ModsChances } from "../models/eft/common/tables/IBotType";
import { Item } from "../models/eft/common/tables/IItem"; import { Item } from "../models/eft/common/tables/IItem";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IBotConfig } from "../models/spt/config/IBotConfig";
@ -33,15 +33,13 @@ export declare class BotLootGenerator {
/** /**
* Add loot to bots containers * Add loot to bots containers
* @param sessionId Session id * @param sessionId Session id
* @param templateInventory x.json from database/bots * @param botJsonTemplate Base json db file for the bot having its loot generated
* @param itemCounts Liits on item types to be added as loot
* @param isPmc Will bot be a pmc * @param isPmc Will bot be a pmc
* @param botRole Role of bot, e.g. asssult * @param botRole Role of bot, e.g. asssult
* @param botInventory Inventory to add loot to * @param botInventory Inventory to add loot to
* @param equipmentChances
* @param botLevel Level of bot * @param botLevel Level of bot
*/ */
generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; generateLoot(sessionId: string, botJsonTemplate: IBotType, isPmc: boolean, botRole: string, botInventory: PmcInventory, botLevel: number): void;
protected getRandomisedCount(min: number, max: number, nValue: number): number; protected getRandomisedCount(min: number, max: number, nValue: number): number;
/** /**
* Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached

View File

@ -23,7 +23,7 @@ export declare class LootGenerator {
* @param options parameters to adjust how loot is generated * @param options parameters to adjust how loot is generated
* @returns An array of loot items * @returns An array of loot items
*/ */
createRandomloot(options: LootRequest): LootItem[]; createRandomLoot(options: LootRequest): LootItem[];
/** /**
* Construct item limit record to hold max and current item count * Construct item limit record to hold max and current item count
* @param limits limits as defined in config * @param limits limits as defined in config

View File

@ -31,7 +31,7 @@ export declare class PMCLootGenerator {
*/ */
generatePMCVestLootPool(): string[]; generatePMCVestLootPool(): string[];
/** /**
* Check if item has a width/hide that lets it fit into a 1x2 slot * Check if item has a width/height that lets it fit into a 1x2/2x1 slot
* 1x1 / 1x2 / 2x1 * 1x1 / 1x2 / 2x1
* @param item Item to check size of * @param item Item to check size of
* @returns true if it fits * @returns true if it fits

View File

@ -171,17 +171,19 @@ declare class ItemHelper {
*/ */
isItemTplStackable(tpl: string): boolean; isItemTplStackable(tpl: string): boolean;
/** /**
* split item stack if it exceeds StackMaxSize * split item stack if it exceeds its StackMaxSize property
* @param itemToSplit item being split into smaller stacks
* @returns Array of split items
*/ */
splitStack(item: Item): Item[]; splitStack(itemToSplit: Item): Item[];
/** /**
* Find Barter items in the inventory * Find Barter items in the inventory
* @param {string} by * @param {string} by tpl or id
* @param {Object} pmcData * @param {Object} pmcData
* @param {string} barterItemId * @param {string} barterItemId
* @returns Array of Item objects * @returns Array of Item objects
*/ */
findBarterItems(by: string, pmcData: IPmcData, barterItemId: string): Item[]; findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[];
/** /**
* *
* @param pmcData * @param pmcData

View File

@ -1,6 +1,11 @@
import { IInventoryConfig } from "../models/spt/config/IInventoryConfig";
import { ConfigServer } from "../servers/ConfigServer";
export declare class PaymentHelper { export declare class PaymentHelper {
protected configServer: ConfigServer;
protected inventoryConfig: IInventoryConfig;
constructor(configServer: ConfigServer);
/** /**
* Check whether tpl is Money * Is the passed in tpl money (also checks custom currencies in inventoryConfig.customMoneyTpls)
* @param {string} tpl * @param {string} tpl
* @returns void * @returns void
*/ */

View File

@ -1,5 +1,6 @@
import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcData } from "../models/eft/common/IPmcData";
import { Quest } from "../models/eft/common/tables/IBotBase"; import { Quest } from "../models/eft/common/tables/IBotBase";
import { Item } from "../models/eft/common/tables/IItem";
import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "../models/eft/common/tables/IQuest";
import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse";
import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData";
@ -42,10 +43,10 @@ export declare class QuestHelper {
/** /**
* Get status of a quest in player profile by its id * Get status of a quest in player profile by its id
* @param pmcData Profile to search * @param pmcData Profile to search
* @param questID Quest id to look up * @param questId Quest id to look up
* @returns QuestStatus enum * @returns QuestStatus enum
*/ */
getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus; getQuestStatus(pmcData: IPmcData, questId: string): QuestStatus;
/** /**
* returns true is the level condition is satisfied * returns true is the level condition is satisfied
* @param playerLevel Players level * @param playerLevel Players level
@ -81,14 +82,19 @@ export declare class QuestHelper {
* @returns true if loyalty is high enough to fulfill quest requirement * @returns true if loyalty is high enough to fulfill quest requirement
*/ */
traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean;
/**
* take reward item from quest and set FiR status + fix stack sizes + fix mod Ids
* @param reward Reward item to fix
* @returns Fixed rewards
*/
protected processReward(reward: Reward): Reward[]; protected processReward(reward: Reward): Reward[];
/** /**
* Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success)
* @param quest quest to get rewards for * @param quest quest to get rewards for
* @param state Quest status that holds the items (Started, Success, Fail) * @param status Quest status that holds the items (Started, Success, Fail)
* @returns array of items with the correct maxStack * @returns array of items with the correct maxStack
*/ */
getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[];
/** /**
* Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile
* @param pmcData Player profile * @param pmcData Player profile
@ -97,19 +103,19 @@ export declare class QuestHelper {
*/ */
getQuestReadyForProfile(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): Quest; getQuestReadyForProfile(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): Quest;
/** /**
* TODO: what is going on here * Get quests that can be shown to player after starting a quest
* @param acceptedQuestId Quest to add to profile * @param startedQuestId Quest started by player
* @param sessionID Session id * @param sessionID Session id
* @returns Array of quests in profile + quest passed in as param * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started
*/ */
acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[];
/** /**
* TODO: what is going on here * Get quests that can be shown to player after failing a quest
* @param failedQuestId * @param failedQuestId Id of the quest failed by player
* @param sessionID Session id * @param sessionId Session id
* @returns * @returns
*/ */
failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; failedUnlocked(failedQuestId: string, sessionId: string): IQuest[];
/** /**
* Adjust quest money rewards by passed in multiplier * Adjust quest money rewards by passed in multiplier
* @param quest Quest to multiple money rewards * @param quest Quest to multiple money rewards
@ -127,6 +133,13 @@ export declare class QuestHelper {
* @param output ItemEvent router response * @param output ItemEvent router response
*/ */
changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void;
/**
* Add item stack change object into output route event response
* @param output Response to add item change event into
* @param sessionId Session id
* @param item Item that was adjusted
*/
protected addItemStackSizeChangeIntoEventResponse(output: IItemEventRouterResponse, sessionId: string, item: Item): void;
/** /**
* Get quests, strip all requirement conditions except level * Get quests, strip all requirement conditions except level
* @param quests quests to process * @param quests quests to process

View File

@ -8,8 +8,10 @@ import { SaveServer } from "../servers/SaveServer";
import { FenceService } from "../services/FenceService"; import { FenceService } from "../services/FenceService";
import { LocalisationService } from "../services/LocalisationService"; import { LocalisationService } from "../services/LocalisationService";
import { PlayerService } from "../services/PlayerService"; import { PlayerService } from "../services/PlayerService";
import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil"; import { TimeUtil } from "../utils/TimeUtil";
import { HandbookHelper } from "./HandbookHelper"; import { HandbookHelper } from "./HandbookHelper";
import { ItemHelper } from "./ItemHelper";
import { ProfileHelper } from "./ProfileHelper"; import { ProfileHelper } from "./ProfileHelper";
export declare class TraderHelper { export declare class TraderHelper {
protected logger: ILogger; protected logger: ILogger;
@ -17,15 +19,19 @@ export declare class TraderHelper {
protected saveServer: SaveServer; protected saveServer: SaveServer;
protected profileHelper: ProfileHelper; protected profileHelper: ProfileHelper;
protected handbookHelper: HandbookHelper; protected handbookHelper: HandbookHelper;
protected itemHelper: ItemHelper;
protected playerService: PlayerService; protected playerService: PlayerService;
protected localisationService: LocalisationService; protected localisationService: LocalisationService;
protected fenceService: FenceService; protected fenceService: FenceService;
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
protected randomUtil: RandomUtil;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected traderConfig: ITraderConfig; protected traderConfig: ITraderConfig;
/** Dictionary of item tpl and the highest trader rouble price */ /** Dictionary of item tpl and the highest trader sell rouble price */
protected highestTraderPriceItems: Record<string, number>; protected highestTraderPriceItems: Record<string, number>;
constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); /** Dictionary of item tpl and the highest trader buy back rouble price */
protected highestTraderBuyPriceItems: Record<string, number>;
constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer);
getTrader(traderID: string, sessionID: string): ITraderBase; getTrader(traderID: string, sessionID: string): ITraderBase;
getTraderAssortsById(traderId: string): ITraderAssort; getTraderAssortsById(traderId: string): ITraderAssort;
/** /**
@ -82,8 +88,15 @@ export declare class TraderHelper {
}): void; }): void;
/** /**
* Get the highest rouble price for an item from traders * Get the highest rouble price for an item from traders
* UNUSED
* @param tpl Item to look up highest pride for * @param tpl Item to look up highest pride for
* @returns highest rouble cost for item * @returns highest rouble cost for item
*/ */
getHighestTraderPriceRouble(tpl: string): number; getHighestTraderPriceRouble(tpl: string): number;
/**
* Get the highest price item can be sold to trader for (roubles)
* @param tpl Item to look up best trader sell-to price
* @returns Rouble price
*/
getHighestSellToTraderPrice(tpl: string): number;
} }

View File

@ -1,5 +1,6 @@
export declare class WeightedRandomHelper { export declare class WeightedRandomHelper {
/** /**
* USE getWeightedValue() WHERE POSSIBLE
* Gets a tplId from a weighted dictionary * Gets a tplId from a weighted dictionary
* @param {tplId: weighting[]} itemArray * @param {tplId: weighting[]} itemArray
* @returns tplId * @returns tplId
@ -7,6 +8,9 @@ export declare class WeightedRandomHelper {
getWeightedInventoryItem(itemArray: { getWeightedInventoryItem(itemArray: {
[tplId: string]: unknown; [tplId: string]: unknown;
} | ArrayLike<unknown>): string; } | ArrayLike<unknown>): string;
getWeightedValue<T>(itemArray: {
[key: string]: unknown;
} | ArrayLike<unknown>): T;
/** /**
* Picks the random item based on its weight. * Picks the random item based on its weight.
* The items with higher weight will be picked more often (with a higher probability). * The items with higher weight will be picked more often (with a higher probability).

View File

@ -122,24 +122,27 @@ export interface Inventory {
questStashItems: string; questStashItems: string;
fastPanel: Record<string, string>; fastPanel: Record<string, string>;
} }
export interface IBaseJsonSkills {
Common: Record<string, Common>;
Mastering: Record<string, Mastering>;
Points: number;
}
export interface Skills { export interface Skills {
Common: Common[]; Common: Common[];
Mastering: Mastering[]; Mastering: Mastering[];
Points: number; Points: number;
} }
export interface Common { export interface IBaseSkill {
Id: string; Id: string;
Progress: number; Progress: number;
PointsEarnedDuringSession?: number;
LastAccess?: number;
max?: number; max?: number;
min?: number; min?: number;
} }
export interface Mastering { export interface Common extends IBaseSkill {
Id: string; PointsEarnedDuringSession?: number;
Progress: number; LastAccess?: number;
max?: number; }
min?: number; export interface Mastering extends IBaseSkill {
} }
export interface Stats { export interface Stats {
CarriedQuestItems: string[]; CarriedQuestItems: string[];

View File

@ -104,13 +104,17 @@ export interface Generation {
items: ItemMinMax; items: ItemMinMax;
} }
export interface ItemMinMax { export interface ItemMinMax {
grenades: MinMax; grenades: MinMaxWithWhitelist;
healing: MinMax; healing: MinMaxWithWhitelist;
drugs: MinMax; drugs: MinMaxWithWhitelist;
stims: MinMax; stims: MinMaxWithWhitelist;
looseLoot: MinMax; looseLoot: MinMaxWithWhitelist;
magazines: MinMax; magazines: MinMaxWithWhitelist;
specialItems: MinMax; specialItems: MinMaxWithWhitelist;
}
export interface MinMaxWithWhitelist extends MinMax {
/** Array of item tpls */
whitelist: string[];
} }
export interface Health { export interface Health {
BodyParts: BodyPart[]; BodyParts: BodyPart[];

View File

@ -0,0 +1,6 @@
export interface IConnectResponse {
backendUrl: string;
name: string;
editions: string[];
profileDescriptions: Record<string, string>;
}

View File

@ -0,0 +1,6 @@
export declare enum AirdropTypeEnum {
MIXED = "mixed",
WEAPONARMOR = "weaponarmor",
FOODMEDICAL = "foodmedical",
BARTER = "barter"
}

View File

@ -28,6 +28,6 @@ export declare enum WildSpawnTypeNumber {
BOSSKNIGHT = 67108864, BOSSKNIGHT = 67108864,
FOLLOWERBIGPIPE = 134217728, FOLLOWERBIGPIPE = 134217728,
FOLLOWERBIRDEYE = 268435456, FOLLOWERBIRDEYE = 268435456,
SPTUSEC = 536870912, BOSSZRYACHIY = 536870912,
SPTBEAR = 1073741824 FOLLOWERZRYACHIY = 1073741824
} }

View File

@ -1,5 +1,5 @@
import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; import { ITemplateItem } from "../../eft/common/tables/ITemplateItem";
export declare class BotLootCache { export interface IBotLootCache {
backpackLoot: ITemplateItem[]; backpackLoot: ITemplateItem[];
pocketLoot: ITemplateItem[]; pocketLoot: ITemplateItem[];
vestLoot: ITemplateItem[]; vestLoot: ITemplateItem[];

View File

@ -1,8 +1,10 @@
import { AirdropTypeEnum } from "../../../models/enums/AirdropType";
import { MinMax } from "../../common/MinMax"; import { MinMax } from "../../common/MinMax";
import { IBaseConfig } from "./IBaseConfig"; import { IBaseConfig } from "./IBaseConfig";
export interface IAirdropConfig extends IBaseConfig { export interface IAirdropConfig extends IBaseConfig {
kind: "aki-airdrop"; kind: "aki-airdrop";
airdropChancePercent: AirdropChancePercent; airdropChancePercent: AirdropChancePercent;
airdropTypeWeightings: Record<AirdropTypeEnum, number>;
planeMinFlyHeight: number; planeMinFlyHeight: number;
planeMaxFlyHeight: number; planeMaxFlyHeight: number;
planeVolume: number; planeVolume: number;
@ -10,7 +12,7 @@ export interface IAirdropConfig extends IBaseConfig {
crateFallSpeed: number; crateFallSpeed: number;
airdropMinStartTimeSeconds: number; airdropMinStartTimeSeconds: number;
airdropMaxStartTimeSeconds: number; airdropMaxStartTimeSeconds: number;
loot: AirdropLoot; loot: Record<string, AirdropLoot>;
} }
export interface AirdropChancePercent { export interface AirdropChancePercent {
bigmap: number; bigmap: number;
@ -22,12 +24,12 @@ export interface AirdropChancePercent {
tarkovStreets: number; tarkovStreets: number;
} }
export interface AirdropLoot { export interface AirdropLoot {
presetCount: MinMax; presetCount?: MinMax;
itemCount: MinMax; itemCount: MinMax;
itemBlacklist: string[]; itemBlacklist: string[];
itemTypeWhitelist: string[]; itemTypeWhitelist: string[];
/** key: item base type: value: max count */ /** key: item base type: value: max count */
itemLimits: Record<string, number>; itemLimits: Record<string, number>;
itemStackLimits: Record<string, MinMax>; itemStackLimits: Record<string, MinMax>;
armorLevelWhitelist: number[]; armorLevelWhitelist?: number[];
} }

View File

@ -1,3 +1,4 @@
import { MinMaxWithWhitelist } from "../../../models/eft/common/tables/IBotType";
import { MinMax } from "../../common/MinMax"; import { MinMax } from "../../common/MinMax";
import { IBaseConfig } from "./IBaseConfig"; import { IBaseConfig } from "./IBaseConfig";
import { IBotDurability } from "./IBotDurability"; import { IBotDurability } from "./IBotDurability";
@ -85,7 +86,7 @@ export interface ModLimits {
} }
export interface RandomisationDetails { export interface RandomisationDetails {
levelRange: MinMax; levelRange: MinMax;
generation?: Record<string, MinMax>; generation?: Record<string, MinMaxWithWhitelist>;
randomisedWeaponModSlots?: string[]; randomisedWeaponModSlots?: string[];
randomisedArmorSlots?: string[]; randomisedArmorSlots?: string[];
/** Equipment chances */ /** Equipment chances */

View File

@ -4,5 +4,6 @@ export interface ICoreConfig extends IBaseConfig {
akiVersion: string; akiVersion: string;
projectName: string; projectName: string;
compatibleTarkovVersion: string; compatibleTarkovVersion: string;
serverName: string;
commit: string; commit: string;
} }

View File

@ -3,6 +3,8 @@ export interface IInventoryConfig extends IBaseConfig {
kind: "aki-inventory"; kind: "aki-inventory";
newItemsMarkedFound: boolean; newItemsMarkedFound: boolean;
randomLootContainers: Record<string, RewardDetails>; randomLootContainers: Record<string, RewardDetails>;
/** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */
customMoneyTpls: string[];
} }
export interface RewardDetails { export interface RewardDetails {
rewardCount: number; rewardCount: number;

View File

@ -2,16 +2,24 @@ import { MinMax } from "../../common/MinMax";
import { IBaseConfig } from "./IBaseConfig"; import { IBaseConfig } from "./IBaseConfig";
export interface IRagfairConfig extends IBaseConfig { export interface IRagfairConfig extends IBaseConfig {
kind: "aki-ragfair"; kind: "aki-ragfair";
/** How many seconds should pass before expired offers and procesed + player offers checked if sold */
runIntervalSeconds: number; runIntervalSeconds: number;
/** Player listing settings */
sell: Sell; sell: Sell;
/** Trader ids + should their assorts be listed on flea*/
traders: Record<string, boolean>; traders: Record<string, boolean>;
dynamic: Dynamic; dynamic: Dynamic;
} }
export interface Sell { export interface Sell {
/** Should a fee be deducted from player when liting an item for sale */
fees: boolean; fees: boolean;
/** Settings to control chances of offer being sold */
chance: Chance; chance: Chance;
/** Settings to control how long it takes for a player offer to sell */
time: Time; time: Time;
/** Player offer reputation gain/loss settings */
reputation: Reputation; reputation: Reputation;
/** How many hours are simulated to figure out if player offer was sold */
simulatedSellHours: number; simulatedSellHours: number;
} }
export interface Chance { export interface Chance {
@ -32,48 +40,77 @@ export interface Dynamic {
purchasesAreFoundInRaid: boolean; purchasesAreFoundInRaid: boolean;
/** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */
useTraderPriceForOffersIfHigher: boolean; useTraderPriceForOffersIfHigher: boolean;
/** Barter offer specific settings */
barter: Barter; barter: Barter;
/** Dynamic offer price below handbook adjustment values */
offerAdjustment: OfferAdjustment; offerAdjustment: OfferAdjustment;
/** How many offers should expire before an offer regeneration occurs */
expiredOfferThreshold: number; expiredOfferThreshold: number;
/** How many offers should be listed */
offerItemCount: MinMax; offerItemCount: MinMax;
/** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */
price: MinMax; price: MinMax;
/** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */
presetPrice: MinMax; presetPrice: MinMax;
/** Should default presets to listed only or should non-standard presets found in globals.json be listed too */
showDefaultPresetsOnly: boolean; showDefaultPresetsOnly: boolean;
endTimeSeconds: MinMax; endTimeSeconds: MinMax;
/** Settings to control the durability range of item items listed on flea */
condition: Condition; condition: Condition;
/** Size stackable items should be listed for in percent of max stack size */
stackablePercent: MinMax; stackablePercent: MinMax;
/** Items that cannot be stacked can have multiples sold in one offer, what range of values can be listed */
nonStackableCount: MinMax; nonStackableCount: MinMax;
/** Range of rating offers for items being listed */
rating: MinMax; rating: MinMax;
/** Percentages to sell offers in each currency */
currencies: Record<string, number>; currencies: Record<string, number>;
/** Item tpls that should be forced to sell as a single item */
showAsSingleStack: string[]; showAsSingleStack: string[];
/** Should christmas/halloween items be removed from flea when not within the seasonal bounds */
removeSeasonalItemsWhenNotInEvent: boolean; removeSeasonalItemsWhenNotInEvent: boolean;
/** Flea blacklist settings */
blacklist: Blacklist; blacklist: Blacklist;
} }
export interface Barter { export interface Barter {
/** Should barter offers be generated */
enable: boolean; enable: boolean;
/** Percentage change an offer is listed as a barter */
chancePercent: number; chancePercent: number;
/** Min number of required items for a barter requirement */
itemCountMin: number; itemCountMin: number;
/** Max number of required items for a barter requirement */
itemCountMax: number; itemCountMax: number;
/** How much can the total price of requested items vary from the item offered */
priceRangeVariancePercent: number; priceRangeVariancePercent: number;
/** Min rouble price for an offer to be considered for turning into a barter */
minRoubleCostToBecomeBarter: number; minRoubleCostToBecomeBarter: number;
/** Item Tpls to never be turned into a barter */
itemTypeBlacklist: string[]; itemTypeBlacklist: string[];
} }
export interface OfferAdjustment { export interface OfferAdjustment {
/** Shuld offer price be adjusted when below handbook price */
adjustPriceWhenBelowHandbookPrice: boolean;
/** How big a percentage difference does price need to vary from handbook to be considered for adjustment */
maxPriceDifferenceBelowHandbookPercent: number; maxPriceDifferenceBelowHandbookPercent: number;
/** How much to multiply the handbook price to get the new price */
handbookPriceMultipier: number; handbookPriceMultipier: number;
/** What is the minimum rouble price to consider adjusting price of item */
priceThreshholdRub: number; priceThreshholdRub: number;
} }
export interface Condition { export interface Condition {
/** Percentage change durability is altered */
conditionChance: number; conditionChance: number;
min: number; min: number;
max: number; max: number;
} }
export interface Blacklist { export interface Blacklist {
/** /** Custom blacklist for item Tpls */
* show/hide trader items that are blacklisted by bsg
*/
traderItems: boolean;
custom: string[]; custom: string[];
/** BSG blacklist a large number of items from flea, true = use blacklist */
enableBsgList: boolean; enableBsgList: boolean;
/** Should quest items be blacklisted from flea */
enableQuestList: boolean; enableQuestList: boolean;
/** Should trader items that are blacklisted by bsg */
traderItems: boolean;
} }

View File

@ -1,5 +1,5 @@
import { MinMax } from "../../common/MinMax"; import { MinMax } from "../../common/MinMax";
export declare class LootRequest { export interface LootRequest {
presetCount: MinMax; presetCount: MinMax;
itemCount: MinMax; itemCount: MinMax;
itemBlacklist: string[]; itemBlacklist: string[];

View File

@ -1,6 +1,5 @@
import { BotHelper } from "../helpers/BotHelper"; import { BotHelper } from "../helpers/BotHelper";
import { MinMax } from "../models/common/MinMax"; import { EquipmentChances, Generation, IBotType, MinMaxWithWhitelist, ModsChances } from "../models/eft/common/tables/IBotType";
import { EquipmentChances, Generation, IBotType, ModsChances } from "../models/eft/common/tables/IBotType";
import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails";
import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
@ -30,7 +29,7 @@ export declare class BotEquipmentFilterService {
* @param generationChanges Changes to apply * @param generationChanges Changes to apply
* @param baseBotGeneration dictionary to update * @param baseBotGeneration dictionary to update
*/ */
protected adjustGenerationChances(generationChanges: Record<string, MinMax>, baseBotGeneration: Generation): void; protected adjustGenerationChances(generationChanges: Record<string, MinMaxWithWhitelist>, baseBotGeneration: Generation): void;
/** /**
* Get equipment settings for bot * Get equipment settings for bot
* @param botEquipmentRole equipment role to return * @param botEquipmentRole equipment role to return

View File

@ -1,7 +1,8 @@
import { PMCLootGenerator } from "../generators/PMCLootGenerator"; import { PMCLootGenerator } from "../generators/PMCLootGenerator";
import { Items } from "../models/eft/common/tables/IBotType"; import { ItemHelper } from "../helpers/ItemHelper";
import { IBotType } from "../models/eft/common/tables/IBotType";
import { ITemplateItem, Props } from "../models/eft/common/tables/ITemplateItem"; import { ITemplateItem, Props } from "../models/eft/common/tables/ITemplateItem";
import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; import { IBotLootCache, LootCacheType } from "../models/spt/bots/IBotLootCache";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { JsonUtil } from "../utils/JsonUtil"; import { JsonUtil } from "../utils/JsonUtil";
@ -10,12 +11,13 @@ import { RagfairPriceService } from "./RagfairPriceService";
export declare class BotLootCacheService { export declare class BotLootCacheService {
protected logger: ILogger; protected logger: ILogger;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected itemHelper: ItemHelper;
protected databaseServer: DatabaseServer; protected databaseServer: DatabaseServer;
protected pmcLootGenerator: PMCLootGenerator; protected pmcLootGenerator: PMCLootGenerator;
protected localisationService: LocalisationService; protected localisationService: LocalisationService;
protected ragfairPriceService: RagfairPriceService; protected ragfairPriceService: RagfairPriceService;
protected lootCache: Record<string, BotLootCache>; protected lootCache: Record<string, IBotLootCache>;
constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService);
/** /**
* Remove all cached bot loot data * Remove all cached bot loot data
*/ */
@ -25,17 +27,17 @@ export declare class BotLootCacheService {
* @param botRole bot to get loot for * @param botRole bot to get loot for
* @param isPmc is the bot a pmc * @param isPmc is the bot a pmc
* @param lootType what type of loot is needed (backpack/pocket/stim/vest etc) * @param lootType what type of loot is needed (backpack/pocket/stim/vest etc)
* @param lootPool the full pool of loot (needed when cache is empty) * @param botJsonTemplate Base json db file for the bot having its loot generated
* @returns ITemplateItem array * @returns ITemplateItem array
*/ */
getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, lootPool: Items): ITemplateItem[]; getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[];
/** /**
* Generate loot for a bot and store inside a private class property * Generate loot for a bot and store inside a private class property
* @param botRole bots role (assault / pmcBot etc) * @param botRole bots role (assault / pmcBot etc)
* @param lootPool the full pool of loot we use to create the various sub-categories with
* @param isPmc Is the bot a PMC (alteres what loot is cached) * @param isPmc Is the bot a PMC (alteres what loot is cached)
* @param botJsonTemplate db template for bot having its loot generated
*/ */
protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void;
/** /**
* Sort a pool of item objects by its flea price * Sort a pool of item objects by its flea price
* @param poolToSort pool of items to sort * @param poolToSort pool of items to sort

View File

@ -0,0 +1,23 @@
import { IBotBase } from "../models/eft/common/tables/IBotBase";
import { ILogger } from "../models/spt/utils/ILogger";
/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */
export declare class MatchBotDetailsCacheService {
protected logger: ILogger;
protected botDetailsCache: Record<string, IBotBase>;
constructor(logger: ILogger);
/**
* Store a bot in the cache, keyed by its name
* @param botToCache Bot details to cache
*/
cacheBot(botToCache: IBotBase): void;
/**
* Clean the cache of all bot details
*/
clearCache(): void;
/**
* Find a bot in the cache by its name
* @param botName Name of bot to find
* @returns Bot details
*/
getBotByName(botName: string): IBotBase;
}

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