3.4.0 update

This commit is contained in:
Chomp 2022-11-25 22:49:38 +00:00
parent 0cca86c132
commit 3e83b2ee99
71 changed files with 507 additions and 159 deletions

View File

@ -52,6 +52,6 @@ export declare class DialogueCallbacks extends OnUpdate {
listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<any[]>;
friendRequest(url: string, request: IFriendRequestData, sessionID: string): INullResponseData;
sendMessage(url: string, request: ISendMessageRequest, sessionID: string): IGetBodyResponseData<number>;
onUpdate(timeSinceLastRun: number): boolean;
onUpdate(timeSinceLastRun: number): Promise<boolean>;
getRoute(): string;
}

View File

@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad";
export declare class HandbookCallbacks extends OnLoad {
protected handbookController: HandbookController;
constructor(handbookController: HandbookController);
onLoad(): void;
onLoad(): Promise<void>;
getRoute(): string;
}

View File

@ -91,6 +91,6 @@ export declare class HideoutCallbacks extends OnUpdate {
* @returns
*/
takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse;
onUpdate(timeSinceLastRun: number): boolean;
onUpdate(timeSinceLastRun: number): Promise<boolean>;
getRoute(): string;
}

View File

@ -3,7 +3,7 @@ import { HttpServer } from "../servers/HttpServer";
export declare class HttpCallbacks extends OnLoad {
protected httpServer: HttpServer;
constructor(httpServer: HttpServer);
onLoad(): void;
onLoad(): Promise<void>;
getRoute(): string;
getImage(): string;
}

View File

@ -27,6 +27,6 @@ export declare class InsuranceCallbacks extends OnUpdate {
* @returns IItemEventRouterResponse
*/
insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse;
onUpdate(secondsSinceLastRun: number): boolean;
onUpdate(secondsSinceLastRun: number): Promise<boolean>;
getRoute(): string;
}

View File

@ -3,6 +3,7 @@ import { PostAkiModLoader } from "../loaders/PostAkiModLoader";
import { IHttpConfig } from "../models/spt/config/IHttpConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { LocalisationService } from "../services/LocalisationService";
import { HttpFileUtil } from "../utils/HttpFileUtil";
import { HttpResponseUtil } from "../utils/HttpResponseUtil";
declare class ModCallbacks extends OnLoad {
@ -10,10 +11,11 @@ declare class ModCallbacks extends OnLoad {
protected httpResponse: HttpResponseUtil;
protected httpFileUtil: HttpFileUtil;
protected postAkiModLoader: PostAkiModLoader;
protected localisationService: LocalisationService;
protected configServer: ConfigServer;
protected httpConfig: IHttpConfig;
constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer);
onLoad(): void;
constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, localisationService: LocalisationService, configServer: ConfigServer);
onLoad(): Promise<void>;
getRoute(): string;
sendBundle(sessionID: string, req: any, resp: any, body: any): void;
getBundles(url: string, info: any, sessionID: string): string;

View File

@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad";
export declare class PresetCallbacks extends OnLoad {
protected presetController: PresetController;
constructor(presetController: PresetController);
onLoad(): void;
onLoad(): Promise<void>;
getRoute(): string;
}

View File

@ -14,7 +14,6 @@ import { IRemoveOfferRequestData } from "../models/eft/ragfair/IRemoveOfferReque
import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData";
import { ISendRagfairReportRequestData } from "../models/eft/ragfair/ISendRagfairReportRequestData";
import { IRagfairConfig } from "../models/spt/config/IRagfairConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { RagfairServer } from "../servers/RagfairServer";
import { HttpResponseUtil } from "../utils/HttpResponseUtil";
@ -24,14 +23,13 @@ import { JsonUtil } from "../utils/JsonUtil";
*/
export declare class RagfairCallbacks extends OnLoadOnUpdate {
protected httpResponse: HttpResponseUtil;
protected logger: ILogger;
protected jsonUtil: JsonUtil;
protected ragfairServer: RagfairServer;
protected ragfairController: RagfairController;
protected configServer: ConfigServer;
protected ragfairConfig: IRagfairConfig;
constructor(httpResponse: HttpResponseUtil, logger: ILogger, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer);
onLoad(): void;
constructor(httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer);
onLoad(): Promise<void>;
getRoute(): string;
search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData<IGetOffersResult>;
getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData<IGetItemPriceResult>;
@ -39,6 +37,6 @@ export declare class RagfairCallbacks extends OnLoadOnUpdate {
addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse;
removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse;
extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse;
onUpdate(timeSinceLastRun: number): boolean;
onUpdate(timeSinceLastRun: number): Promise<boolean>;
sendReport(url: string, info: ISendRagfairReportRequestData, sessionID: string): INullResponseData;
}

View File

@ -3,7 +3,7 @@ import { SaveServer } from "../servers/SaveServer";
export declare class SaveCallbacks extends OnLoadOnUpdate {
protected saveServer: SaveServer;
constructor(saveServer: SaveServer);
onLoad(): void;
onLoad(): Promise<void>;
getRoute(): string;
onUpdate(secondsSinceLastRun: number): boolean;
onUpdate(secondsSinceLastRun: number): Promise<boolean>;
}

View File

@ -8,8 +8,8 @@ export declare class TraderCallbacks extends OnLoadOnUpdate {
protected httpResponse: HttpResponseUtil;
protected traderController: TraderController;
constructor(httpResponse: HttpResponseUtil, traderController: TraderController);
onLoad(): void;
onUpdate(): boolean;
onLoad(): Promise<void>;
onUpdate(): Promise<boolean>;
getRoute(): string;
getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ITraderBase[]>;
/**

View File

@ -2,6 +2,7 @@ import { ApplicationContext } from "../context/ApplicationContext";
import { BotGenerator } from "../generators/BotGenerator";
import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper";
import { BotHelper } from "../helpers/BotHelper";
import { ProfileHelper } from "../helpers/ProfileHelper";
import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper";
import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData";
import { IBotBase } from "../models/eft/common/tables/IBotBase";
@ -23,18 +24,23 @@ export declare class BotController {
protected botGenerationCacheService: BotGenerationCacheService;
protected localisationService: LocalisationService;
protected weightedRandomHelper: WeightedRandomHelper;
protected profileHelper: ProfileHelper;
protected configServer: ConfigServer;
protected applicationContext: ApplicationContext;
protected jsonUtil: JsonUtil;
protected botConfig: IBotConfig;
static readonly pmcTypeLabel = "PMC";
constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil);
constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil);
/**
* Return the number of bot loadout varieties to be generated
* @param type bot Type we want the loadout gen count for
* @returns
* @returns number of bots to generate
*/
getBotPresetGenerationLimit(type: string): number;
/**
* Get the core.json difficulty settings from database\bots
* @returns IBotCore
*/
getBotCoreDifficulty(): IBotCore;
/**
* Get bot difficulty settings
@ -51,6 +57,12 @@ export declare class BotController {
* @returns IBotBase array
*/
generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[];
/**
* Get the difficulty passed in, if its not "asoline", get selected difficulty from config
* @param requestedDifficulty
* @returns
*/
getPMCDifficulty(requestedDifficulty: string): string;
/**
* Get the max number of bots allowed on a map
* Looks up location player is entering when getting cap value

View File

@ -8,13 +8,15 @@ import { ILogger } from "../models/spt/utils/ILogger";
import { EventOutputHolder } from "../routers/EventOutputHolder";
import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer";
import { LocalisationService } from "../services/LocalisationService";
export declare class CustomizationController {
protected logger: ILogger;
protected eventOutputHolder: EventOutputHolder;
protected databaseServer: DatabaseServer;
protected saveServer: SaveServer;
protected localisationService: LocalisationService;
protected profileHelper: ProfileHelper;
constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper);
constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper);
getTraderSuits(traderID: string, sessionID: string): ISuit[];
wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse;
buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse;

View File

@ -34,6 +34,10 @@ export declare class GameController {
protected coreConfig: ICoreConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, gameEventHelper: GameEventHelper, applicationContext: ApplicationContext, configServer: ConfigServer);
gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void;
/**
* Blank out the "test" mail message from prapor
*/
protected removePraporTestMessage(): void;
/**
* Check if current date falls inside any of the seasons events pased in, if so, handle them
* @param seasonalEvents events to check for

View File

@ -1,23 +1,25 @@
import { ItemHelper } from "../helpers/ItemHelper";
import { PaymentService } from "../services/PaymentService";
import { InventoryHelper } from "../helpers/InventoryHelper";
import { HealthHelper } from "../helpers/HealthHelper";
import { InventoryHelper } from "../helpers/InventoryHelper";
import { ItemHelper } from "../helpers/ItemHelper";
import { IPmcData } from "../models/eft/common/IPmcData";
import { IHealthTreatmentRequestData } from "../models/eft/health/IHealthTreatmentRequestData";
import { IOffraidEatRequestData } from "../models/eft/health/IOffraidEatRequestData";
import { IOffraidHealRequestData } from "../models/eft/health/IOffraidHealRequestData";
import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData";
import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse";
import { EventOutputHolder } from "../routers/EventOutputHolder";
import { ILogger } from "../models/spt/utils/ILogger";
import { EventOutputHolder } from "../routers/EventOutputHolder";
import { LocalisationService } from "../services/LocalisationService";
import { PaymentService } from "../services/PaymentService";
export declare class HealthController {
protected logger: ILogger;
protected eventOutputHolder: EventOutputHolder;
protected itemHelper: ItemHelper;
protected paymentService: PaymentService;
protected inventoryHelper: InventoryHelper;
protected localisationService: LocalisationService;
protected healthHelper: HealthHelper;
constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, healthHelper: HealthHelper);
constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, localisationService: LocalisationService, healthHelper: HealthHelper);
/**
* stores in-raid player health
* @param pmcData Player profile

View File

@ -18,7 +18,9 @@ import { ConfigServer } from "../servers/ConfigServer";
import { SaveServer } from "../servers/SaveServer";
import { BotGenerationCacheService } from "../services/BotGenerationCacheService";
import { BotLootCacheService } from "../services/BotLootCacheService";
import { CustomLocationWaveService } from "../services/CustomLocationWaveService";
import { MatchLocationService } from "../services/MatchLocationService";
import { OpenZoneService } from "../services/OpenZoneService";
import { ProfileSnapshotService } from "../services/ProfileSnapshotService";
export declare class MatchController {
protected logger: ILogger;
@ -29,12 +31,14 @@ export declare class MatchController {
protected botLootCacheService: BotLootCacheService;
protected configServer: ConfigServer;
protected profileSnapshotService: ProfileSnapshotService;
protected customLocationWaveService: CustomLocationWaveService;
protected openZoneService: OpenZoneService;
protected botGenerationCacheService: BotGenerationCacheService;
protected applicationContext: ApplicationContext;
protected matchConfig: IMatchConfig;
protected inraidConfig: IInRaidConfig;
protected botConfig: IBotConfig;
constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext);
constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext);
getEnabled(): boolean;
getProfile(info: IGetProfileRequestData): IPmcData[];
createGroup(sessionID: string, info: ICreateGroupRequestData): any;

View File

@ -5,6 +5,7 @@ import { QuestConditionHelper } from "../helpers/QuestConditionHelper";
import { QuestHelper } from "../helpers/QuestHelper";
import { IPmcData } from "../models/eft/common/IPmcData";
import { IQuest, Reward } from "../models/eft/common/tables/IQuest";
import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests";
import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse";
import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData";
import { ICompleteQuestRequestData } from "../models/eft/quests/ICompleteQuestRequestData";
@ -15,6 +16,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { LocaleService } from "../services/LocaleService";
import { LocalisationService } from "../services/LocalisationService";
import { PlayerService } from "../services/PlayerService";
import { TimeUtil } from "../utils/TimeUtil";
export declare class QuestController {
@ -29,9 +31,10 @@ export declare class QuestController {
protected questConditionHelper: QuestConditionHelper;
protected playerService: PlayerService;
protected localeService: LocaleService;
protected localisationService: LocalisationService;
protected configServer: ConfigServer;
protected questConfig: IQuestConfig;
constructor(logger: ILogger, timeUtil: TimeUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, configServer: ConfigServer);
constructor(logger: ILogger, timeUtil: TimeUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, localisationService: LocalisationService, configServer: ConfigServer);
/**
* Get all quests visible to player
* Exclude quests with incomplete preconditions (level/loyalty)
@ -56,6 +59,13 @@ export declare class QuestController {
*/
acceptQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse;
acceptRepeatableQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse;
/**
* Look for an accepted quest inside player profile, return matching
* @param pmcData Profile to search through
* @param acceptedQuest Quest to search for
* @returns IRepeatableQuest
*/
protected getRepeatableQuestFromProfile(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData): IRepeatableQuest;
/**
* Update completed quest in profile
* Add newly unlocked quests to profile

View File

@ -67,16 +67,16 @@ export declare class RagfairController {
protected configServer: ConfigServer;
protected ragfairConfig: IRagfairConfig;
constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, localisationService: LocalisationService, configServer: ConfigServer);
getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult;
getOffers(sessionID: string, searchRequest: ISearchRequestData): IGetOffersResult;
/**
* Get offers for the client based on type of search being performed
* @param searchRequest Client search request data
* @param itemsToAdd
* @param assorts
* @param traderAssorts Trader assorts
* @param pmcProfile Player profile
* @returns array of offers
*/
protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record<string, ITraderAssort>, pmcProfile: IPmcData): IRagfairOffer[];
protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record<string, ITraderAssort>, pmcProfile: IPmcData): IRagfairOffer[];
/**
* Get categories for the type of search being performed, linked/required/all
* @param searchRequest Client search request data

View File

@ -98,6 +98,13 @@ export declare class RepeatableQuestController {
* @returns {array} array of "repeatableQuestObjects" as descibed above
*/
getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[];
/**
* Get repeatable quest data from profile from name (daily/weekly), creates base repeatable quest object if none exists
* @param repeatableConfig daily/weekly config
* @param pmcData Profile to search
* @returns IPmcDataRepeatableQuest
*/
protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest;
/**
* This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json).
* It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest

View File

@ -1,4 +1,4 @@
export declare class OnLoad {
onLoad(): void;
onLoad(): Promise<void>;
getRoute(): string;
}

View File

@ -1,7 +1,7 @@
import { OnLoad } from "./OnLoad";
import { OnUpdate } from "./OnUpdate";
export declare class OnLoadOnUpdate implements OnLoad, OnUpdate {
onUpdate(timeSinceLastRun: number): boolean;
onLoad(): void;
onUpdate(timeSinceLastRun: number): Promise<boolean>;
onLoad(): Promise<void>;
getRoute(): string;
}

View File

@ -1,4 +1,4 @@
export declare class OnUpdate {
onUpdate(timeSinceLastRun: number): boolean;
onUpdate(timeSinceLastRun: number): Promise<boolean>;
getRoute(): string;
}

View File

@ -5,6 +5,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper";
import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper";
import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase";
import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType";
import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails";
import { IBotConfig } from "../models/spt/config/IBotConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
@ -14,12 +15,7 @@ import { HashUtil } from "../utils/HashUtil";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil";
import { BotInventoryGenerator } from "./BotInventoryGenerator";
declare namespace BotGenerator {
interface IRandomisedBotLevelResult {
level: number;
exp: number;
}
}
import { BotLevelGenerator } from "./BotLevelGenerator";
export declare class BotGenerator {
protected logger: ILogger;
protected hashUtil: HashUtil;
@ -28,6 +24,7 @@ export declare class BotGenerator {
protected profileHelper: ProfileHelper;
protected databaseServer: DatabaseServer;
protected botInventoryGenerator: BotInventoryGenerator;
protected botLevelGenerator: BotLevelGenerator;
protected botEquipmentFilterService: BotEquipmentFilterService;
protected weightedRandomHelper: WeightedRandomHelper;
protected botHelper: BotHelper;
@ -35,7 +32,7 @@ export declare class BotGenerator {
protected gameEventHelper: GameEventHelper;
protected configServer: ConfigServer;
protected botConfig: IBotConfig;
constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer);
constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botLevelGenerator: BotLevelGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer);
/**
* Generate a player scav bot object
* @param role e.g. assault / pmcbot
@ -45,23 +42,12 @@ export declare class BotGenerator {
*/
generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase;
/**
* Generate an array of bot objects based on a condition for a raid with
* @param sessionId session id
* @param condition request condition
* @returns bot array
* Create x number of bots of the type/side/difficulty defined in botGenerationDetails
* @param sessionId Session id
* @param botGenerationDetails details on how to generate bots
* @returns array of bots
*/
generateByCondition(sessionId: string, botCountToGenerate: number, difficulty: string, role: string, isPmc: boolean): IBotBase[];
/**
* Get the PMCs wildSpawnType value
* @param role "usec" / "bear"
* @returns wildSpawnType value as string
*/
protected getPmcRoleByDescription(role: string): string;
/**
* Get a randomised PMC side based on bot config value 'isUsec'
* @returns pmc side as string
*/
protected getRandomisedPmcSide(): string;
prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[];
/**
* Get a clone of the database\bots\base.json file
* @returns IBotBase object
@ -71,26 +57,24 @@ export declare class BotGenerator {
* Create a IBotBase object with equipment/loot/exp etc
* @param sessionId Session id
* @param bot bots base file
* @param botRole Role bot will use (bear/usec for PMCs)
* @param node Bot template from db/bots/x.json
* @param isPmc Is bot to be a PMC
* @param isPlayerScav is bot to be a p scav bot
* @param botJsonTemplate Bot template from db/bots/x.json
* @param botGenerationDetails details on how to generate the bot
* @returns IBotBase object
*/
protected generateBot(sessionId: string, bot: IBotBase, botRole: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase;
protected generateBot(sessionId: string, bot: IBotBase, botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails): IBotBase;
/**
* Create a bot nickname
* @param botJsonTemplate x.json from database
* @param isPlayerScav Will bot be player scav
* @param botRole role of bot e.g. assault
* @returns Nickname for bot
*/
protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string): string;
/**
* Log the number of PMCs generated to the debug console
* @param output Generated bot array, ready to send to client
*/
protected logPmcGeneratedCount(output: IBotBase[]): void;
/**
* Return a randomised bot level and exp value
* @param role botRole being generated for
* @param min Min exp value
* @param max Max exp value
* @returns IRandomisedBotLevelResult object
*/
protected generateRandomLevel(role: string, min: number, max: number): BotGenerator.IRandomisedBotLevelResult;
/**
* Converts health object to the required format
* @param healthObj health object from bot json
@ -111,12 +95,6 @@ export declare class BotGenerator {
*/
protected generateId(bot: IBotBase): IBotBase;
protected generateInventoryID(profile: IBotBase): IBotBase;
/**
* Get the difficulty passed in, if its not "asoline", get selected difficulty from config
* @param requestedDifficulty
* @returns
*/
protected getPMCDifficulty(requestedDifficulty: string): string;
/**
* Add a side-specific (usec/bear) dogtag item to a bots inventory
* @param bot bot to add dogtag to
@ -124,4 +102,3 @@ export declare class BotGenerator {
*/
protected generateDogtag(bot: IBotBase): IBotBase;
}
export {};

View File

@ -1,9 +1,10 @@
import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper";
import { BotHelper } from "../helpers/BotHelper";
import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper";
import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase";
import { Chances, Generation, Inventory, Mods } from "../models/eft/common/tables/IBotType";
import { Chances, Generation, IBotType, Inventory, Mods } from "../models/eft/common/tables/IBotType";
import { EquipmentSlots } from "../models/enums/EquipmentSlots";
import { IBotConfig } from "../models/spt/config/IBotConfig";
import { IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
@ -20,22 +21,22 @@ export declare class BotInventoryGenerator {
protected botWeaponGenerator: BotWeaponGenerator;
protected botLootGenerator: BotLootGenerator;
protected botGeneratorHelper: BotGeneratorHelper;
protected botHelper: BotHelper;
protected weightedRandomHelper: WeightedRandomHelper;
protected localisationService: LocalisationService;
protected configServer: ConfigServer;
protected botConfig: IBotConfig;
constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer);
constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, botHelper: BotHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer);
/**
* Add equipment/weapons/loot to bot
* @param sessionId Session id
* @param templateInventory bot/x.json data from db
* @param equipmentChances Chances each item will be added to bot
* @param itemGenerationLimitsMinMax item gen limits for bot role
* @param botJsonTemplate bot/x.json data from db
* @param botRole Role bot has (assault/pmcBot)
* @param isPmc Is bot being converted into a pmc
* @param botLevel Level of bot being generated
* @returns PmcInventory object with equipment/weapons/loot
*/
generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory;
generateInventory(sessionId: string, botJsonTemplate: IBotType, botRole: string, isPmc: boolean, botLevel: number): PmcInventory;
/**
* Create a pmcInventory object with all the base/generic items needed
* @returns PmcInventory object
@ -47,9 +48,20 @@ export declare class BotInventoryGenerator {
* @param equipmentChances Chances items will be added to bot
* @param botRole Role bot has (assault/pmcBot)
* @param botInventory Inventory to add equipment to
* @param botLevel Level of bot
*/
protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory): void;
protected generateEquipment(equipmentSlot: string, equipmentPool: Record<string, number>, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void;
protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void;
/**
* Add a piece of equipment with mods to inventory from the provided pools
* @param equipmentSlot Slot to select an item for
* @param equipmentPool Possible items to choose from
* @param modPool Possible mods to apply to item chosen
* @param spawnChances Chances items will be chosen to be added
* @param botRole Role of bot e.g. assault
* @param inventory Inventory to add item into
* @param randomisationDetails settings from bot.json to adjust how item is generated
*/
protected generateEquipment(equipmentSlot: string, equipmentPool: Record<string, number>, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void;
/**
* Work out what weapons bot should have equipped and add them to bot inventory
* @param templateInventory bot/x.json data from db
@ -58,9 +70,10 @@ export declare class BotInventoryGenerator {
* @param botInventory Inventory to add weapons to
* @param botRole assault/pmcBot/bossTagilla etc
* @param isPmc Is the bot being generated as a pmc
* @param botLevel level of bot having weapon generated
* @param itemGenerationLimitsMinMax Limits for items the bot can have
*/
protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void;
protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void;
/**
* Calculate if the bot should have weapons in Primary/Secondary/Holster slots
* @param equipmentChances Chances bot has certain equipment
@ -84,5 +97,5 @@ export declare class BotInventoryGenerator {
protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: {
slot: EquipmentSlots;
shouldSpawn: boolean;
}, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void;
}, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void;
}

View File

@ -0,0 +1,29 @@
import { MinMax } from "../models/common/MinMax";
import { IRandomisedBotLevelResult } from "../models/eft/bot/IRandomisedBotLevelResult";
import { ExpTable } from "../models/eft/common/IGlobals";
import { IBotBase } from "../models/eft/common/tables/IBotBase";
import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails";
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer";
import { RandomUtil } from "../utils/RandomUtil";
export declare class BotLevelGenerator {
protected logger: ILogger;
protected randomUtil: RandomUtil;
protected databaseServer: DatabaseServer;
constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer);
/**
* Return a randomised bot level and exp value
* @param levelDetails min and max of level for bot
* @param botGenerationDetails Deatils to help generate a bot
* @param bot being level is being generated for
* @returns IRandomisedBotLevelResult object
*/
generateBotLevel(levelDetails: MinMax, botGenerationDetails: BotGenerationDetails, bot: IBotBase): IRandomisedBotLevelResult;
/**
* Get the highest level a bot can be relative to the players level, but no futher than the max size from globals.exp_table
* @param playerLevel Players current level
* @param relativeDeltaMax max delta above player level to go
* @returns highest level possible for bot
*/
protected getHighestRelativeBotLevel(playerLevel: number, relativeDeltaMax: number, levelDetails: MinMax, expTable: ExpTable[]): number;
}

View File

@ -28,7 +28,18 @@ export declare class BotLootGenerator {
protected configServer: ConfigServer;
protected botConfig: IBotConfig;
constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer);
generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void;
/**
* Add loot to bots containers
* @param sessionId Session id
* @param templateInventory x.json from database/bots
* @param itemCounts Liits on item types to be added as loot
* @param isPmc Will bot be a pmc
* @param botRole Role of bot, e.g. asssult
* @param botInventory Inventory to add loot to
* @param equipmentChances
* @param botLevel Level of bot
*/
generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void;
protected getRandomisedCount(min: number, max: number, nValue: number): number;
/**
* Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached
@ -51,7 +62,7 @@ export declare class BotLootGenerator {
* @param botRole bots role, .e.g. pmcBot
* @param isPmc are we generating for a pmc
*/
protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void;
protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void;
/**
* Get a random item from the pool parameter using the biasedRandomNumber system
* @param pool pool of items to pick an item from

View File

@ -43,7 +43,7 @@ export declare class BotWeaponGenerator {
* @param isPmc Is weapon generated for a pmc
* @returns GenerateWeaponResult object
*/
generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult;
generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult;
/**
* Get a random weighted weapon from a bots pool of weapons
* @param equipmentSlot Primary/secondary/holster
@ -62,7 +62,7 @@ export declare class BotWeaponGenerator {
* @param isPmc
* @returns GenerateWeaponResult object
*/
generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult;
generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult;
/**
* Create array with weapon base as only element and
* add additional properties based on weapon type

View File

@ -9,6 +9,7 @@ import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticL
import { ILocationConfig } from "../models/spt/config/ILocationConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { LocalisationService } from "../services/LocalisationService";
import { JsonUtil } from "../utils/JsonUtil";
import { MathUtil } from "../utils/MathUtil";
import { ObjectId } from "../utils/ObjectId";
@ -29,9 +30,10 @@ export declare class LocationGenerator {
protected gameEventHelper: GameEventHelper;
protected containerHelper: ContainerHelper;
protected presetHelper: PresetHelper;
protected localisationService: LocalisationService;
protected configServer: ConfigServer;
protected locationConfig: ILocationConfig;
constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, gameEventHelper: GameEventHelper, containerHelper: ContainerHelper, presetHelper: PresetHelper, configServer: ConfigServer);
constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, gameEventHelper: GameEventHelper, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer);
generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record<string, IStaticLootDetails>, staticAmmoDist: Record<string, IStaticAmmoDetails[]>, locationName: string): IStaticContainerProps;
protected getLooseLootMultiplerForLocation(location: string): number;
protected getStaticLootMultiplerForLocation(location: string): number;

View File

@ -6,6 +6,7 @@ import { LootRequest } from "../models/spt/services/LootRequest";
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer";
import { ItemFilterService } from "../services/ItemFilterService";
import { LocalisationService } from "../services/LocalisationService";
import { HashUtil } from "../utils/HashUtil";
import { RandomUtil } from "../utils/RandomUtil";
export declare class LootGenerator {
@ -14,8 +15,9 @@ export declare class LootGenerator {
protected databaseServer: DatabaseServer;
protected randomUtil: RandomUtil;
protected itemHelper: ItemHelper;
protected localisationService: LocalisationService;
protected itemFilterService: ItemFilterService;
constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, itemFilterService: ItemFilterService);
constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService);
/**
* Generate a list of items based on configuration options parameter
* @param options parameters to adjust how loot is generated

View File

@ -10,6 +10,7 @@ import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer";
import { BotLootCacheService } from "../services/BotLootCacheService";
import { FenceService } from "../services/FenceService";
import { LocalisationService } from "../services/LocalisationService";
import { JsonUtil } from "../utils/JsonUtil";
import { BotGenerator } from "./BotGenerator";
export declare class PlayerScavGenerator {
@ -21,10 +22,11 @@ export declare class PlayerScavGenerator {
protected jsonUtil: JsonUtil;
protected fenceService: FenceService;
protected botLootCacheService: BotLootCacheService;
protected localisationService: LocalisationService;
protected botGenerator: BotGenerator;
protected configServer: ConfigServer;
protected playerScavConfig: IPlayerScavConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, botGenerator: BotGenerator, configServer: ConfigServer);
constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer);
/**
* Update a player profile to include a new player scav profile
* @param sessionID session id to specify what profile is updated

View File

@ -7,7 +7,7 @@ import { Item } from "../models/eft/common/tables/IItem";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { IBarterScheme } from "../models/eft/common/tables/ITrader";
import { IRagfairOffer, OfferRequirement } from "../models/eft/ragfair/IRagfairOffer";
import { IRagfairConfig } from "../models/spt/config/IRagfairConfig";
import { Dynamic, IRagfairConfig } from "../models/spt/config/IRagfairConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
@ -88,7 +88,16 @@ export declare class RagfairOfferGenerator {
* Create multiple offers for items by using a unique list of items we've generated previously
* @param expiredOffers optional, expired offers to regenerate
*/
generateDynamicOffers(expiredOffers?: Item[]): void;
generateDynamicOffers(expiredOffers?: Item[]): Promise<void>;
protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise<void>;
/**
* Create one flea offer for a specific item
* @param items Item to create offer for
* @param isPreset Is item a weapon preset
* @param itemDetails raw db item details
* @returns
*/
protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise<Item[]>;
/**
* Generate trader offers on flea using the traders assort data
* @param traderID Trader to generate offers for

View File

@ -12,6 +12,7 @@ import { LocalisationService } from "../services/LocalisationService";
import { HashUtil } from "../utils/HashUtil";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil";
import { BotHelper } from "./BotHelper";
import { BotWeaponGeneratorHelper } from "./BotWeaponGeneratorHelper";
import { ContainerHelper } from "./ContainerHelper";
import { InventoryHelper } from "./InventoryHelper";
@ -44,10 +45,11 @@ export declare class BotGeneratorHelper {
protected itemFilterService: ItemFilterService;
protected profileHelper: ProfileHelper;
protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper;
protected botHelper: BotHelper;
protected localisationService: LocalisationService;
protected configServer: ConfigServer;
protected botConfig: IBotConfig;
constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, configServer: ConfigServer);
constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botHelper: BotHelper, localisationService: LocalisationService, configServer: ConfigServer);
/**
* Check mods are compatible and add to array
* @param equipment Equipment item to add mods to
@ -61,6 +63,7 @@ export declare class BotGeneratorHelper {
*/
generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[];
/**
* Add mods to a weapon using the provided mod pool
* @param sessionId session id
* @param weapon Weapon to add mods to
* @param modPool Pool of compatible mods to attach to weapon
@ -71,7 +74,7 @@ export declare class BotGeneratorHelper {
* @param botRole Role of bot weapon is generated for
* @returns Weapon + mods array
*/
generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[];
generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string, botLevel: number): Item[];
/**
*
* @param modSlot Slot mod will fit into
@ -209,6 +212,18 @@ export declare class BotGeneratorHelper {
generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): {
upd?: Upd;
};
/**
* Get the chance for the light or laser to be set as active on weapon, default to 50% if no bot/equip settings found
* @param botRole role of bot with weapon
* @returns Percent chance to be active
*/
protected getLightLaserActiveChance(botRole: string): number;
/**
* Get the chance for the faceshield to be set as enabled, default to 75% if no bot/equip settings found
* @param botRole role of bot with faceshield
* @returns Percent chance to be active
*/
protected getFaceShieldActiveChance(botRole: string): number;
/**
* Create a repairable object for a weapon that containers durability + max durability properties
* @param itemTemplate weapon object being generated for

View File

@ -1,5 +1,6 @@
import { MinMax } from "../models/common/MinMax";
import { Difficulty, IBotType } from "../models/eft/common/tables/IBotType";
import { IBotConfig } from "../models/spt/config/IBotConfig";
import { EquipmentFilters, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
@ -59,4 +60,29 @@ export declare class BotHelper {
* @returns true if should be a pmc
*/
shouldBotBePmc(botRole: string): boolean;
rollChanceToBePmc(role: string, botConvertMinMax: MinMax): boolean;
botRoleIsPmc(botRole: string): boolean;
/**
* Get randomisation settings for bot from config/bot.json
* @param botLevel level of bot
* @param botEquipConfig bot equipment json
* @returns RandomisationDetails
*/
getBotRandomisationDetails(botLevel: number, botEquipConfig: EquipmentFilters): RandomisationDetails;
/**
* Choose between sptBear and sptUsec at random based on the % defined in botConfig.pmc.isUsec
* @returns pmc role
*/
getRandomisedPmcRole(): string;
/**
* Get the corrisponding side when sptBear or sptUsec is passed in
* @param botRole role to get side for
* @returns side (usec/bear)
*/
getPmcSideByRole(botRole: string): string;
/**
* Get a randomised PMC side based on bot config value 'isUsec'
* @returns pmc side as string
*/
protected getRandomisedPmcSide(): string;
}

View File

@ -4,6 +4,7 @@ import { Item } from "../models/eft/common/tables/IItem";
import { Grid, ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer";
import { LocalisationService } from "../services/LocalisationService";
import { HashUtil } from "../utils/HashUtil";
import { RandomUtil } from "../utils/RandomUtil";
import { ContainerHelper } from "./ContainerHelper";
@ -16,8 +17,9 @@ export declare class BotWeaponGeneratorHelper {
protected randomUtil: RandomUtil;
protected hashUtil: HashUtil;
protected inventoryHelper: InventoryHelper;
protected localisationService: LocalisationService;
protected containerHelper: ContainerHelper;
constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper);
constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, localisationService: LocalisationService, containerHelper: ContainerHelper);
/**
* Get a randomised number of bullets for a specific magazine
* @param magCounts min and max count of magazines

View File

@ -4,6 +4,7 @@ import { MessageType } from "../models/enums/MessageType";
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer";
import { LocalisationService } from "../services/LocalisationService";
import { HashUtil } from "../utils/HashUtil";
import { ItemHelper } from "./ItemHelper";
import { NotificationSendHelper } from "./NotificationSendHelper";
@ -15,8 +16,9 @@ export declare class DialogueHelper {
protected databaseServer: DatabaseServer;
protected notifierHelper: NotifierHelper;
protected notificationSendHelper: NotificationSendHelper;
protected localisationService: LocalisationService;
protected itemHelper: ItemHelper;
constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, itemHelper: ItemHelper);
constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper);
createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent;
/**
* Add a templated message to the dialogue.

View File

@ -11,6 +11,7 @@ export declare class LookupCollection {
}
export declare class HandbookHelper {
protected databaseServer: DatabaseServer;
protected lookupCacheGenerated: boolean;
protected handbookPriceCache: LookupCollection;
constructor(databaseServer: DatabaseServer);
hydrateLookup(): void;

View File

@ -5,12 +5,15 @@ import { IStaticAmmoDetails } from "../models/eft/common/tables/ILootBase";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer";
import { ItemBaseClassService } from "../services/ItemBaseClassService";
import { LocaleService } from "../services/LocaleService";
import { LocalisationService } from "../services/LocalisationService";
import { HashUtil } from "../utils/HashUtil";
import { JsonUtil } from "../utils/JsonUtil";
import { MathUtil } from "../utils/MathUtil";
import { ObjectId } from "../utils/ObjectId";
import { RandomUtil } from "../utils/RandomUtil";
import { HandbookHelper } from "./HandbookHelper";
declare class ItemHelper {
protected logger: ILogger;
protected hashUtil: HashUtil;
@ -19,8 +22,11 @@ declare class ItemHelper {
protected objectId: ObjectId;
protected mathUtil: MathUtil;
protected databaseServer: DatabaseServer;
protected handbookHelper: HandbookHelper;
protected itemBaseClassService: ItemBaseClassService;
protected localisationService: LocalisationService;
protected localeService: LocaleService;
constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, localeService: LocaleService);
constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService);
/**
* Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash
* @param {string} tpl the template id / tpl

View File

@ -10,6 +10,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { LocaleService } from "../services/LocaleService";
import { LocalisationService } from "../services/LocalisationService";
import { HashUtil } from "../utils/HashUtil";
import { JsonUtil } from "../utils/JsonUtil";
import { TimeUtil } from "../utils/TimeUtil";
@ -32,10 +33,11 @@ export declare class QuestHelper {
protected dialogueHelper: DialogueHelper;
protected profileHelper: ProfileHelper;
protected paymentHelper: PaymentHelper;
protected localisationService: LocalisationService;
protected traderHelper: TraderHelper;
protected configServer: ConfigServer;
protected questConfig: IQuestConfig;
constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer);
constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, configServer: ConfigServer);
/**
* Get status of a quest by quest id
* @param pmcData Profile to search

View File

@ -46,7 +46,7 @@ export declare class RagfairOfferHelper {
protected ragfairConfig: IRagfairConfig;
protected questConfig: IQuestConfig;
constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer);
getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record<string, ITraderAssort>, pmcProfile: IPmcData): IRagfairOffer[];
getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record<string, ITraderAssort>, pmcProfile: IPmcData): IRagfairOffer[];
getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record<string, ITraderAssort>, pmcProfile: IPmcData): IRagfairOffer[];
/**
* Check if trader offers' BuyRestrictionMax value has been reached
@ -64,5 +64,5 @@ export declare class RagfairOfferHelper {
protected getProfileOffers(sessionID: string): IRagfairOffer[];
protected deleteOfferByOfferId(sessionID: string, offerId: string): void;
protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse;
isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], assorts: Record<string, ITraderAssort>, offer: IRagfairOffer, pmcProfile: IPmcData): boolean;
isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record<string, ITraderAssort>, offer: IRagfairOffer, pmcProfile: IPmcData): boolean;
}

View File

@ -7,6 +7,7 @@ import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { FenceService } from "../services/FenceService";
import { LocalisationService } from "../services/LocalisationService";
import { TraderAssortService } from "../services/TraderAssortService";
import { JsonUtil } from "../utils/JsonUtil";
import { MathUtil } from "../utils/MathUtil";
@ -27,11 +28,12 @@ export declare class TraderAssortHelper {
protected ragfairAssortGenerator: RagfairAssortGenerator;
protected ragfairOfferGenerator: RagfairOfferGenerator;
protected traderAssortService: TraderAssortService;
protected localisationService: LocalisationService;
protected traderHelper: TraderHelper;
protected fenceService: FenceService;
protected configServer: ConfigServer;
protected traderConfig: ITraderConfig;
constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer);
constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, localisationService: LocalisationService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer);
/**
* Get a traders assorts
* Can be used for returning ragfair / fence assorts

View File

@ -4,7 +4,7 @@ import { PreAkiModLoader } from "./PreAkiModLoader";
export declare class PostDBModLoader implements OnLoad {
protected preAkiModLoader: PreAkiModLoader;
constructor(preAkiModLoader: PreAkiModLoader);
onLoad(): void;
onLoad(): Promise<void>;
getRoute(): string;
getModPath(mod: string): string;
protected executeMods(container: DependencyContainer): void;

View File

@ -0,0 +1,4 @@
export interface IRandomisedBotLevelResult {
level: number;
exp: number;
}

View File

@ -107,7 +107,6 @@ export interface CurrentMax {
Maximum: number;
}
export interface Inventory {
discardLimits: Record<string, number>;
items: Item[];
equipment: string;
stash: string;

View File

@ -37,7 +37,7 @@ export interface Conditions {
export interface AvailableForConditions {
_parent: string;
_props: AvailableForProps;
dynamicLocale: boolean;
dynamicLocale?: boolean;
}
export interface AvailableForProps {
id: string;

View File

@ -1,4 +1,4 @@
export interface IGetSuitsResponse {
_id: string;
suits: string[];
suites: string[];
}

View File

@ -0,0 +1,7 @@
export declare enum ExitStatus {
SURVIVED = 0,
KILLED = 1,
LEFT = 2,
RUNNER = 3,
MISSINGINACTION = 4
}

View File

@ -0,0 +1,18 @@
export interface BotGenerationDetails {
/** Should the bot be generated as a PMC */
isPmc: boolean;
/** assault/pmcBot etc */
role: string;
/** Side of bot */
side: string;
/** Active players current level */
playerLevel: number;
/** Delta of highest level of bot */
botRelativeLevelDeltaMax: number;
/** How many to create and store */
botCountToGenerate: number;
/** Desired difficulty of the bot */
botDifficulty: string;
/** Will the generated bot be a player scav */
isPlayerScav: boolean;
}

View File

@ -66,10 +66,9 @@ export interface LootNvalue {
}
export interface EquipmentFilters {
weaponModLimits: ModLimits;
randomisedWeaponModSlots?: string[];
randomisedArmorSlots?: string[];
faceShieldIsActiveChancePercent?: number;
lightLaserIsActiveChancePercent?: number;
randomisation: RandomisationDetails[];
blacklist: EquipmentFilterDetails[];
whitelist: EquipmentFilterDetails[];
clothing: WeightingAdjustmentDetails[];
@ -81,6 +80,15 @@ export interface ModLimits {
/** How many lasers or lights are allowed on a weapon - hard coded to work with TACTICAL_COMBO, and FLASHLIGHT */
lightLaserLimit?: number;
}
export interface RandomisationDetails {
levelRange: MinMax;
randomisedWeaponModSlots?: string[];
randomisedArmorSlots?: string[];
/** Equipment chances */
equipment?: Record<string, number>;
/** Modc chances */
mods?: Record<string, number>;
}
export interface EquipmentFilterDetails {
levelRange: MinMax;
equipment: Record<string, string[]>;
@ -88,6 +96,11 @@ export interface EquipmentFilterDetails {
}
export interface WeightingAdjustmentDetails {
levelRange: MinMax;
ammo?: AdjustmentDetails;
equipment?: AdjustmentDetails;
clothing?: AdjustmentDetails;
}
export interface AdjustmentDetails {
add: Record<string, Record<string, number>>;
edit: Record<string, Record<string, number>>;
}

View File

@ -1,8 +1,16 @@
import { BossLocationSpawn, Wave } from "../../../models/eft/common/ILocationBase";
import { IBaseConfig } from "./IBaseConfig";
export interface ILocationConfig extends IBaseConfig {
kind: "aki-location";
looseLootMultiplier: LootMultiplier;
staticLootMultiplier: LootMultiplier;
customWaves: CustomWaves;
/** Open zones to add to map */
openZones: Record<string, string[]>;
}
export interface CustomWaves {
boss: Record<string, BossLocationSpawn[]>;
normal: Record<string, Wave[]>;
}
export interface LootMultiplier {
bigmap: number;

View File

@ -16,6 +16,7 @@ export interface IPmcConfig {
maxVestLootTotalRub: number;
convertIntoPmcChance: Record<string, MinMax>;
enemyTypes: string[];
botRelativeLevelDeltaMax: number;
}
export interface PmcTypes {
usec: string;

View File

@ -1,14 +1,16 @@
import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse";
import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest";
import { ProfileHelper } from "../helpers/ProfileHelper";
import { ItemEventRouterDefinition } from "../di/Router";
import { ProfileHelper } from "../helpers/ProfileHelper";
import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest";
import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse";
import { ILogger } from "../models/spt/utils/ILogger";
import { LocalisationService } from "../services/LocalisationService";
import { EventOutputHolder } from "./EventOutputHolder";
export declare class ItemEventRouter {
protected logger: ILogger;
protected profileHelper: ProfileHelper;
protected itemEventRouters: ItemEventRouterDefinition[];
protected localisationService: LocalisationService;
protected eventOutputHolder: EventOutputHolder;
constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], eventOutputHolder: EventOutputHolder);
constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder);
handleEvents(info: IItemEventRouterRequest, sessionID: string): IItemEventRouterResponse;
}

View File

@ -4,6 +4,7 @@ import { TraderHelper } from "../helpers/TraderHelper";
import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer";
import { IRagfairConfig } from "../models/spt/config/IRagfairConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { LocalisationService } from "../services/LocalisationService";
import { RagfairCategoriesService } from "../services/RagfairCategoriesService";
import { RagfairOfferService } from "../services/RagfairOfferService";
import { RagfairRequiredItemsService } from "../services/RagfairRequiredItemsService";
@ -14,13 +15,14 @@ export declare class RagfairServer {
protected ragfairOfferService: RagfairOfferService;
protected ragfairCategoriesService: RagfairCategoriesService;
protected ragfairRequiredItemsService: RagfairRequiredItemsService;
protected localisationService: LocalisationService;
protected traderHelper: TraderHelper;
protected traderAssortHelper: TraderAssortHelper;
protected configServer: ConfigServer;
protected ragfairConfig: IRagfairConfig;
constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer);
load(): void;
update(): void;
constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, localisationService: LocalisationService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer);
load(): Promise<void>;
update(): Promise<void>;
/**
* Get traders who need to be periodically refreshed
* @returns string array of traders

View File

@ -1,21 +1,29 @@
import { IBotType } from "../models/eft/common/tables/IBotType";
import { EquipmentFilters, EquipmentFilterDetails, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig";
import { BotHelper } from "../helpers/BotHelper";
import { EquipmentChances, IBotType, ModsChances } from "../models/eft/common/tables/IBotType";
import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails";
import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
export declare class BotEquipmentFilterService {
protected logger: ILogger;
protected botHelper: BotHelper;
protected configServer: ConfigServer;
protected botConfig: IBotConfig;
protected botEquipmentConfig: Record<string, EquipmentFilters>;
constructor(logger: ILogger, configServer: ConfigServer);
constructor(logger: ILogger, botHelper: BotHelper, configServer: ConfigServer);
/**
* Filter a bots data to exclude equipment and cartridges defines in the botConfig
* @param baseBotNode bots json data to filter
* @param playerLevel Level of the currently playing player
* @param isPmc Is the bot we're filtering a PMC
* @param role Role of the bot we're filtering
* @param botLevel Level of the bot
* @param botGenerationDetails details on how to generate a bot
*/
filterBotEquipment(baseBotNode: IBotType, playerLevel: number, isPmc: boolean, role: string): void;
filterBotEquipment(baseBotNode: IBotType, botLevel: number, botGenerationDetails: BotGenerationDetails): void;
/**
* Iterate over the changes passed in and alter data in baseValues
* @param equipmentChanges Changes to apply
* @param baseValues Values to update
*/
protected adjustChances(equipmentChanges: Record<string, number>, baseValues: EquipmentChances | ModsChances): void;
/**
* Get an object that contains equipment and cartridge blacklists for a specified bot type
* @param botRole Role of the bot we want the blacklist for
@ -66,5 +74,5 @@ export declare class BotEquipmentFilterService {
* @param weightingAdjustments Weighting change to apply to bot
* @param botItemPool Bot item dictionary to adjust
*/
protected adjustWeighting(weightingAdjustments: WeightingAdjustmentDetails, botItemPool: Record<string, any>): void;
protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record<string, any>, showEditWarnings?: boolean): void;
}

View File

@ -3,32 +3,34 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase";
import { ILogger } from "../models/spt/utils/ILogger";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil";
import { LocalisationService } from "./LocalisationService";
export declare class BotGenerationCacheService {
protected logger: ILogger;
protected randomUtil: RandomUtil;
protected jsonUtil: JsonUtil;
protected localisationService: LocalisationService;
protected botHelper: BotHelper;
protected storedBots: Map<string, IBotBase[]>;
constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper);
constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper);
/**
* Store array of bots in cache, shuffle results before storage
* @param botsToStore Bots we want to store in the cache
*/
storeBots(botsToStore: IBotBase[]): void;
storeBots(key: string, botsToStore: IBotBase[]): void;
/**
* Find and return a bot based on its role
* Remove bot from internal array so it can't be retreived again
* @param role role to retreive (assault/bossTagilla etc)
* @param key role to retreive (assault/bossTagilla etc)
* @returns IBotBase object
*/
getBot(role: string): IBotBase;
getBot(key: string): IBotBase;
/**
* Remove all cached bot profiles
*/
clearStoredBots(): void;
/**
* Does cache have bots
* @returns true if empty
* Does cache have a bot with requested key
* @returns false if empty
*/
cacheHasBotOfRole(role: string): boolean;
cacheHasBotOfRole(key: string): boolean;
}

View File

@ -5,15 +5,17 @@ import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache";
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer";
import { JsonUtil } from "../utils/JsonUtil";
import { LocalisationService } from "./LocalisationService";
import { RagfairPriceService } from "./RagfairPriceService";
export declare class BotLootCacheService {
protected logger: ILogger;
protected jsonUtil: JsonUtil;
protected databaseServer: DatabaseServer;
protected pmcLootGenerator: PMCLootGenerator;
protected localisationService: LocalisationService;
protected ragfairPriceService: RagfairPriceService;
protected lootCache: Record<string, BotLootCache>;
constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, ragfairPriceService: RagfairPriceService);
constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService);
/**
* Remove all cached bot loot data
*/

View File

@ -0,0 +1,42 @@
import { BossLocationSpawn, Wave } from "../models/eft/common/ILocationBase";
import { ILocationConfig } from "../models/spt/config/ILocationConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil";
export declare class CustomLocationWaveService {
protected logger: ILogger;
protected randomUtil: RandomUtil;
protected jsonUtil: JsonUtil;
protected databaseServer: DatabaseServer;
protected configServer: ConfigServer;
protected locationConfig: ILocationConfig;
constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer);
/**
* Add a boss wave to a map
* @param locationId e.g. factory4_day, bigmap
* @param waveToAdd Boss wave to add to map
*/
addBossWaveToMap(locationId: string, waveToAdd: BossLocationSpawn): void;
/**
* Add a normal bot wave to a map
* @param locationId e.g. factory4_day, bigmap
* @param waveToAdd Wave to add to map
*/
addNormalWaveToMap(locationId: string, waveToAdd: Wave): void;
/**
* Clear all custom boss waves from a map
* @param locationId e.g. factory4_day, bigmap
*/
clearBossWavesForMap(locationId: string): void;
/**
* Clear all custom normal waves from a map
* @param locationId e.g. factory4_day, bigmap
*/
clearNormalWavesForMap(locationId: string): void;
/**
* Add custom boss and normal waves to maps found in config/location.json to db
*/
applyWaveChangesToAllMaps(): void;
}

View File

@ -15,6 +15,7 @@ import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil";
import { ItemFilterService } from "./ItemFilterService";
import { LocalisationService } from "./LocalisationService";
/**
* Handle actions surrounding Fence
* e.g. generating or refreshing assorts / get next refresh time
@ -30,11 +31,12 @@ export declare class FenceService {
protected itemHelper: ItemHelper;
protected presetHelper: PresetHelper;
protected itemFilterService: ItemFilterService;
protected localisationService: LocalisationService;
protected configServer: ConfigServer;
protected fenceAssort: ITraderAssort;
protected traderConfig: ITraderConfig;
protected nextMiniRefreshTimestamp: number;
constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, configServer: ConfigServer);
constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, localisationService: LocalisationService, configServer: ConfigServer);
protected setFenceAssort(fenceAssort: ITraderAssort): void;
/**
* Get assorts player can purchase

View File

@ -1,4 +1,5 @@
import { DialogueHelper } from "../helpers/DialogueHelper";
import { HandbookHelper } from "../helpers/HandbookHelper";
import { SecureContainerHelper } from "../helpers/SecureContainerHelper";
import { TraderHelper } from "../helpers/TraderHelper";
import { IPmcData } from "../models/eft/common/IPmcData";
@ -21,10 +22,11 @@ export declare class InsuranceService {
protected saveServer: SaveServer;
protected traderHelper: TraderHelper;
protected dialogueHelper: DialogueHelper;
protected handbookHelper: HandbookHelper;
protected configServer: ConfigServer;
protected insured: Record<string, Record<string, Item[]>>;
protected insuranceConfig: IInsuranceConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, configServer: ConfigServer);
constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, configServer: ConfigServer);
insuranceExists(sessionId: string): boolean;
insuranceTraderArrayExists(sessionId: string, traderId: string): boolean;
getInsurance(sessionId: string): Record<string, Item[]>;

View File

@ -0,0 +1,37 @@
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer";
/**
* Cache the baseids for each item in the tiems db inside a dictionary
*/
export declare class ItemBaseClassService {
protected logger: ILogger;
protected databaseServer: DatabaseServer;
protected itemBaseClassesCache: Record<string, string[]>;
protected cacheGenerated: boolean;
constructor(logger: ILogger, databaseServer: DatabaseServer);
/**
* Create cache and store inside ItemBaseClassService
*/
hydrateItemBaseClassCache(): void;
/**
* Helper method, recursivly iterate through items parent items, finding and adding ids to dictionary
* @param itemIdToUpdate item tpl to store base ids against in dictionary
* @param item item being checked
* @param allDbItems all items in db
*/
protected addBaseItems(itemIdToUpdate: string, item: ITemplateItem, allDbItems: Record<string, ITemplateItem>): void;
/**
* Does item tpl inherit from the requested base class
* @param itemTpl item to check base classes of
* @param baseClass base class to check for
* @returns true if item inherits from base class passed in
*/
itemHasBaseClass(itemTpl: string, baseClass: string): boolean;
/**
* Get base classes item inherits from
* @param itemTpl item to get base classes for
* @returns array of base classes
*/
getItemBaseClasses(itemTpl: string): string[];
}

View File

@ -0,0 +1,28 @@
import { ILocationConfig } from "../models/spt/config/ILocationConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil";
import { LocalisationService } from "./LocalisationService";
/** Service for adding new zones to a maps OpenZones property */
export declare class OpenZoneService {
protected logger: ILogger;
protected randomUtil: RandomUtil;
protected jsonUtil: JsonUtil;
protected databaseServer: DatabaseServer;
protected localisationService: LocalisationService;
protected configServer: ConfigServer;
protected locationConfig: ILocationConfig;
constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer);
/**
* Add open zone to specified map
* @param locationId map location (e.g. factory4_day)
* @param zoneToAdd zone to add
*/
addZoneToMap(locationId: string, zoneToAdd: string): void;
/**
* Add open zones to all maps found in config/location.json to db
*/
applyZoneChangesToAllMaps(): void;
}

View File

@ -1,3 +1,4 @@
import { RagfairOfferHolder } from "../utils/RagfairOfferHolder";
import { ProfileHelper } from "../helpers/ProfileHelper";
import { RagfairServerHelper } from "../helpers/RagfairServerHelper";
import { Item } from "../models/eft/common/tables/IItem";
@ -26,10 +27,9 @@ export declare class RagfairOfferService {
protected localisationService: LocalisationService;
protected configServer: ConfigServer;
protected playerOffersLoaded: boolean;
protected expiredOffers: Item[];
/** offerId, offer */
protected offers: Record<string, IRagfairOffer>;
protected expiredOffers: Record<string, IRagfairOffer>;
protected ragfairConfig: IRagfairConfig;
protected ragfairOfferHandler: RagfairOfferHolder;
constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer);
/**
* Get all offers
@ -45,7 +45,7 @@ export declare class RagfairOfferService {
* Get an array of expired items not yet processed into new offers
* @returns items that need to be turned into offers
*/
getExpiredOffers(): Item[];
getExpiredOfferItems(): Item[];
resetExpiredOffers(): void;
/**
* Does the offer exist on the ragfair
@ -64,12 +64,6 @@ export declare class RagfairOfferService {
traderOffersNeedRefreshing(traderID: string): boolean;
addPlayerOffers(): void;
expireStaleOffers(): void;
/**
* Get an array of stale offers that are still shown to player
* @returns IRagfairOffer array
*/
protected getStaleOffers(): IRagfairOffer[];
protected isStale(offer: IRagfairOffer, time: number): boolean;
protected processStaleOffer(staleOffer: IRagfairOffer): void;
protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse;
}

View File

@ -24,7 +24,7 @@ export declare class RagfairPriceService implements OnLoad {
protected generatedStaticPrices: boolean;
protected prices: IRagfairServerPrices;
constructor(handbookHelper: HandbookHelper, databaseServer: DatabaseServer, logger: ILogger, itemHelper: ItemHelper, presetHelper: PresetHelper, randomUtil: RandomUtil, configServer: ConfigServer);
onLoad(): void;
onLoad(): Promise<void>;
getRoute(): string;
/**
* Iterate over all items of type "Item" in db and get template price, store in cache

View File

@ -7,6 +7,6 @@ export declare class RagfairRequiredItemsService {
protected ragfairOfferService: RagfairOfferService;
protected requiredItemsCache: {};
constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService);
getRequiredItems(searchId: string): any;
getRequiredItemsById(searchId: string): any;
buildRequiredItemTable(): void;
}

View File

@ -3,6 +3,6 @@ export declare class OnLoadMod extends OnLoad {
private onLoadOverride;
private getRouteOverride;
constructor(onLoadOverride: () => void, getRouteOverride: () => string);
onLoad(): void;
onLoad(): Promise<void>;
getRoute(): string;
}

View File

@ -3,6 +3,6 @@ export declare class OnUpdateMod extends OnUpdate {
private onUpdateOverride;
private getRouteOverride;
constructor(onUpdateOverride: (timeSinceLastRun: number) => boolean, getRouteOverride: () => string);
onUpdate(timeSinceLastRun: number): boolean;
onUpdate(timeSinceLastRun: number): Promise<boolean>;
getRoute(): string;
}

View File

@ -11,7 +11,7 @@ export declare class App {
protected onUpdateComponents: OnUpdate[];
protected onUpdateLastRun: {};
constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]);
load(): void;
protected update(onUpdateComponents: OnUpdate[]): void;
load(): Promise<void>;
protected update(onUpdateComponents: OnUpdate[]): Promise<void>;
protected logUpdateException(err: any, updateable: OnUpdate): void;
}

View File

@ -14,13 +14,13 @@ export declare class DatabaseImporter extends OnLoad {
protected databaseServer: DatabaseServer;
protected imageRouter: ImageRouter;
constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter);
onLoad(): void;
onLoad(): Promise<void>;
/**
* Read all json files in database folder and map into a json object
* @param filepath path to database folder
*/
protected hydrateDatabase(filepath: string): void;
protected hydrateDatabase(filepath: string): Promise<void>;
getRoute(): string;
loadRecursive(filepath: string): IDatabaseTables;
loadRecursive(filepath: string): Promise<IDatabaseTables>;
loadImages(filepath: string): void;
}

View File

@ -6,6 +6,7 @@ export declare class JsonUtil {
protected hashUtil: HashUtil;
protected logger: ILogger;
protected fileHashes: any;
protected jsonCacheExists: boolean;
constructor(vfs: VFS, hashUtil: HashUtil, logger: ILogger);
/**
* From object to string

View File

@ -53,6 +53,12 @@ export declare class WinstonLogger implements ILogger {
warning(data: string | Record<string, unknown>): Promise<void>;
success(data: string | Record<string, unknown>): Promise<void>;
info(data: string | Record<string, unknown>): Promise<void>;
/**
* Log to console text with a customisable text and background color. Background defaults to black
* @param data text to log
* @param textColor color of text
* @param backgroundColor color of background
*/
logWithColor(data: string | Record<string, unknown>, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): Promise<void>;
debug(data: string | Record<string, unknown>, onlyShowInConsole?: boolean): Promise<void>;
}

View File

@ -0,0 +1,24 @@
import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer";
export declare class RagfairOfferHolder {
private offersById;
private offersByTemplate;
private offersByTrader;
constructor();
getOfferById(id: string): IRagfairOffer;
getOffersByTemplate(templateId: string): Array<IRagfairOffer>;
getOffersByTrader(traderId: string): Array<IRagfairOffer>;
getOffers(): Array<IRagfairOffer>;
addOffers(offers: Array<IRagfairOffer>): void;
addOffer(offer: IRagfairOffer): void;
removeOffer(offer: IRagfairOffer): void;
removeOffers(offers: Array<IRagfairOffer>): void;
removeOfferByTrader(traderId: string): void;
/**
* Get an array of stale offers that are still shown to player
* @returns IRagfairOffer array
*/
getStaleOffers(time: number): Array<IRagfairOffer>;
private addOfferByTemplates;
private addOfferByTrader;
protected isStale(offer: IRagfairOffer, time: number): boolean;
}

View File

@ -30,7 +30,11 @@ export declare class Watermark {
* @returns string
*/
getVersionTag(withEftVersion?: boolean): string;
getVersionLabel(): string;
/**
* Get text shown in game on screen, can't be translated as it breaks bsgs client when certian characters are used
* @returns string
*/
getInGameVersionLabel(): string;
/** Set window title */
setTitle(): void;
/** Reset console cursor to top */

View File

@ -1,4 +1,4 @@
# Mod examples for 3.3.0
# Mod examples for 3.4.0
A collection of example mods that perform typical actions in SPT