Update types for 3.4.0

This commit is contained in:
Chomp 2022-12-20 18:32:21 +00:00
parent 37c8ff1a12
commit 2dc93fda84
1638 changed files with 17556 additions and 7532 deletions

View File

@ -8,7 +8,6 @@ import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction";
import { IHideoutScavCase } from "../models/eft/hideout/IHideoutScavCase";
import { IHideoutSettingsBase } from "../models/eft/hideout/IHideoutSettingsBase";
import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData";
import { ILanguageBase } from "../models/spt/server/ILocaleBase";
import { ISettingsBase } from "../models/spt/server/ISettingsBase";
import { DatabaseServer } from "../servers/DatabaseServer";
import { HttpResponseUtil } from "../utils/HttpResponseUtil";
@ -54,7 +53,7 @@ export declare class DataCallbacks {
getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IHideoutArea[]>;
gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IHideoutProduction[]>;
getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IHideoutScavCase[]>;
getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ILanguageBase[]>;
getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<Record<string, string>>;
getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<string>;
getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string;
}

View File

@ -1,6 +1,7 @@
import { DialogueController } from "../controllers/DialogueController";
import { OnUpdate } from "../di/OnUpdate";
import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData";
import { IChatServer } from "../models/eft/dialog/IChatServer";
import { IFriendRequestData } from "../models/eft/dialog/IFriendRequestData";
import { IGetAllAttachmentsRequestData } from "../models/eft/dialog/IGetAllAttachmentsRequestData";
import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse";
@ -35,7 +36,7 @@ export declare class DialogueCallbacks extends OnUpdate {
* Handles client/chatServer/list
* @returns
*/
getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData<any[]>;
getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData<IChatServer[]>;
getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData<DialogueInfo[]>;
getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData<IGetMailDialogViewResponseData>;
getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData<DialogueInfo>;
@ -52,6 +53,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

@ -3,6 +3,15 @@ import { ContextVariableType } from "./ContextVariableType";
export declare class ApplicationContext {
private variables;
private static holderMaxSize;
/**
* Called like:
*
* const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue<IRegisterPlayerRequestData>();
*
* const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.MATCH_INFO).getValue<IStartOfflineRaidRequestData>();
* @param type
* @returns
*/
getLatestValue(type: ContextVariableType): ContextVariable;
getValues(type: ContextVariableType): ContextVariable[];
addValue(type: ContextVariableType, value: any): void;

View File

@ -4,5 +4,7 @@ export declare enum ContextVariableType {
/** Currently acive raid information */
MATCH_INFO = 1,
/** Timestamp when client first connected */
CLIENT_START_TIMESTAMP = 2
CLIENT_START_TIMESTAMP = 2,
/** When player is loading into map and loot is requested */
REGISTER_PLAYER_REQUEST = 3
}

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

@ -27,6 +27,7 @@ export declare class DialogueController {
*/
getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo;
/**
* Handle player clicking 'messenger' and seeing all the messages they've recieved
* Set the content of the dialogue on the details panel, showing all the messages
* for the specified dialogue.
* @param dialogueID Dialog id

View File

@ -1,59 +1,50 @@
import { ApplicationContext } from "../context/ApplicationContext";
import { GameEventHelper } from "../helpers/GameEventHelper";
import { HttpServerHelper } from "../helpers/HttpServerHelper";
import { ProfileHelper } from "../helpers/ProfileHelper";
import { PreAkiModLoader } from "../loaders/PreAkiModLoader";
import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData";
import { Config } from "../models/eft/common/IGlobals";
import { IPmcData } from "../models/eft/common/IPmcData";
import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse";
import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse";
import { IServerDetails } from "../models/eft/game/IServerDetails";
import { IAkiProfile } from "../models/eft/profile/IAkiProfile";
import { ICoreConfig } from "../models/spt/config/ICoreConfig";
import { IHttpConfig } from "../models/spt/config/IHttpConfig";
import { ISeasonalEvent } from "../models/spt/config/ISeasonalEventConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { LocaleService } from "../services/LocaleService";
import { LocalisationService } from "../services/LocalisationService";
import { ProfileFixerService } from "../services/ProfileFixerService";
import { Watermark } from "../utils/Watermark";
import { SeasonalEventService } from "../services/SeasonalEventService";
export declare class GameController {
protected logger: ILogger;
protected databaseServer: DatabaseServer;
protected watermark: Watermark;
protected preAkiModLoader: PreAkiModLoader;
protected httpServerHelper: HttpServerHelper;
protected localeService: LocaleService;
protected profileHelper: ProfileHelper;
protected profileFixerService: ProfileFixerService;
protected localisationService: LocalisationService;
protected gameEventHelper: GameEventHelper;
protected seasonalEventService: SeasonalEventService;
protected applicationContext: ApplicationContext;
protected configServer: ConfigServer;
protected httpConfig: IHttpConfig;
protected coreConfig: ICoreConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, gameEventHelper: GameEventHelper, applicationContext: ApplicationContext, configServer: ConfigServer);
constructor(logger: ILogger, databaseServer: DatabaseServer, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer);
gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void;
/**
* Check if current date falls inside any of the seasons events pased in, if so, handle them
* @param seasonalEvents events to check for
* Get a list of installed mods and save their details to the profile being used
* @param fullProfile Profile to add mod details to
*/
protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void;
protected saveActiveModsToProfile(fullProfile: IAkiProfile): void;
/**
* Make adjusted to server code based on the name of the event passed in
* @param globalConfig globals.json
* @param eventName Name of the event to enable. e.g. Christmas
* Add the logged in players name to PMC name pool
* @param pmcProfile
*/
protected updateGlobalEvents(globalConfig: Config, eventName: string): void;
protected addPlayerToPMCNames(pmcProfile: IPmcData): void;
/**
* Read in data from seasonalEvents.json and add found equipment items to bots
* @param eventName Name of the event to read equipment in from config
* Blank out the "test" mail message from prapor
*/
protected addEventGearToScavs(eventName: string): void;
/**
* Set Khorovod(dancing tree) chance to 100% on all maps that support it
*/
protected enableDancingTree(): void;
protected removePraporTestMessage(): void;
/**
* Make non-trigger-spawned raiders spawn earlier + always
*/
@ -61,6 +52,5 @@ export declare class GameController {
protected logProfileDetails(fullProfile: IAkiProfile): void;
getGameConfig(sessionID: string): IGameConfigResponse;
getServer(): IServerDetails[];
protected addPumpkinsToScavBackpacks(): void;
getValidGameVersion(): ICheckVersionResponse;
}

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

@ -1,3 +1,4 @@
import { ApplicationContext } from "../context/ApplicationContext";
import { PlayerScavGenerator } from "../generators/PlayerScavGenerator";
import { HealthHelper } from "../helpers/HealthHelper";
import { InRaidHelper } from "../helpers/InRaidHelper";
@ -35,12 +36,13 @@ export declare class InraidController {
protected traderHelper: TraderHelper;
protected insuranceService: InsuranceService;
protected inRaidHelper: InRaidHelper;
protected applicationContext: ApplicationContext;
protected configServer: ConfigServer;
protected airdropConfig: IAirdropConfig;
protected inraidConfig: IInRaidConfig;
constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer);
constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer);
/**
* Save locationid to active profiles inraid object
* Save locationId to active profiles inraid object AND app context
* @param sessionID Session id
* @param info Register player request
*/

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,11 +16,14 @@ 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 { HttpResponseUtil } from "../utils/HttpResponseUtil";
import { TimeUtil } from "../utils/TimeUtil";
export declare class QuestController {
protected logger: ILogger;
protected timeUtil: TimeUtil;
protected httpResponseUtil: HttpResponseUtil;
protected eventOutputHolder: EventOutputHolder;
protected databaseServer: DatabaseServer;
protected itemHelper: ItemHelper;
@ -29,9 +33,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, httpResponseUtil: HttpResponseUtil, 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)
@ -55,7 +60,30 @@ export declare class QuestController {
* @returns client response
*/
acceptQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse;
/**
* Get a quests startedMessageText key from db, if no startedMessageText key found, use description key instead
* @param startedMessageTextId startedMessageText property from IQuest
* @param questDescriptionId description property from IQuest
* @returns message id
*/
protected getMessageIdForQuestStart(startedMessageTextId: string, questDescriptionId: string): string;
/**
* Handle the client accepting a repeatable quest and starting it
* Send starting rewards if any to player and
* Send start notification if any to player
* @param pmcData Profile to update with new quest
* @param acceptedQuest Quest being accepted
* @param sessionID Session id
* @returns 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
@ -100,8 +100,9 @@ export declare class RagfairController {
/**
* Update a trader flea offer with buy restrictions stored in the traders assort
* @param offer flea offer to update
* @param profile full profile of player
*/
protected setTraderOfferPurchaseLimits(offer: IRagfairOffer): void;
protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void;
protected isLinkedSearch(info: ISearchRequestData): boolean;
protected isRequiredSearch(info: ISearchRequestData): boolean;
update(): void;

View File

@ -20,6 +20,7 @@ import { ItemFilterService } from "../services/ItemFilterService";
import { LocalisationService } from "../services/LocalisationService";
import { PaymentService } from "../services/PaymentService";
import { ProfileFixerService } from "../services/ProfileFixerService";
import { HttpResponseUtil } from "../utils/HttpResponseUtil";
import { JsonUtil } from "../utils/JsonUtil";
import { MathUtil } from "../utils/MathUtil";
import { ObjectId } from "../utils/ObjectId";
@ -56,6 +57,7 @@ export declare class RepeatableQuestController {
protected timeUtil: TimeUtil;
protected logger: ILogger;
protected randomUtil: RandomUtil;
protected httpResponse: HttpResponseUtil;
protected mathUtil: MathUtil;
protected jsonUtil: JsonUtil;
protected databaseServer: DatabaseServer;
@ -71,7 +73,7 @@ export declare class RepeatableQuestController {
protected itemFilterService: ItemFilterService;
protected configServer: ConfigServer;
protected questConfig: IQuestConfig;
constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer);
constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer);
/**
* This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint
* Returns an array of objects in the format of repeatable quests to the client.
@ -98,6 +100,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
@ -146,6 +155,12 @@ export declare class RepeatableQuestController {
* @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json)
*/
generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination;
/**
* Cpnvert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567)
* @param locationKey e.g factory4_day
* @returns guid
*/
protected getQuestLocationByMapId(locationKey: string): string;
/**
* Exploration repeatable quests can specify a required extraction point.
* This method creates the according object which will be appended to the conditions array

View File

@ -8,13 +8,15 @@ import { Upd } from "../models/eft/common/tables/IItem";
import { IProcessBaseTradeRequestData } from "../models/eft/trade/IProcessBaseTradeRequestData";
import { EventOutputHolder } from "../routers/EventOutputHolder";
import { ILogger } from "../models/spt/utils/ILogger";
import { HttpResponseUtil } from "../utils/HttpResponseUtil";
declare class TradeController {
protected logger: ILogger;
protected eventOutputHolder: EventOutputHolder;
protected tradeHelper: TradeHelper;
protected profileHelper: ProfileHelper;
protected ragfairServer: RagfairServer;
constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer);
protected httpResponse: HttpResponseUtil;
constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil);
confirmTrading(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse;
confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse;
}

View File

@ -7,6 +7,7 @@ import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer";
import { FenceService } from "../services/FenceService";
import { TraderAssortService } from "../services/TraderAssortService";
import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService";
import { JsonUtil } from "../utils/JsonUtil";
import { TimeUtil } from "../utils/TimeUtil";
export declare class TraderController {
@ -17,10 +18,11 @@ export declare class TraderController {
protected traderHelper: TraderHelper;
protected timeUtil: TimeUtil;
protected traderAssortService: TraderAssortService;
protected traderPurchasePersisterService: TraderPurchasePersisterService;
protected fenceService: FenceService;
protected fenceBaseAssortGenerator: FenceBaseAssortGenerator;
protected jsonUtil: JsonUtil;
constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil);
constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil);
/**
* Runs when onLoad event is fired
* Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService

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

@ -0,0 +1,200 @@
import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper";
import { BotHelper } from "../helpers/BotHelper";
import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper";
import { ItemHelper } from "../helpers/ItemHelper";
import { ProbabilityHelper } from "../helpers/ProbabilityHelper";
import { ProfileHelper } from "../helpers/ProfileHelper";
import { Mods, ModsChances } from "../models/eft/common/tables/IBotType";
import { Item } from "../models/eft/common/tables/IItem";
import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem";
import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService";
import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService";
import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService";
import { ItemFilterService } from "../services/ItemFilterService";
import { LocalisationService } from "../services/LocalisationService";
import { HashUtil } from "../utils/HashUtil";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil";
export declare class BotEquipmentModGenerator {
protected logger: ILogger;
protected jsonUtil: JsonUtil;
protected hashUtil: HashUtil;
protected randomUtil: RandomUtil;
protected probabilityHelper: ProbabilityHelper;
protected databaseServer: DatabaseServer;
protected itemHelper: ItemHelper;
protected botEquipmentFilterService: BotEquipmentFilterService;
protected itemFilterService: ItemFilterService;
protected profileHelper: ProfileHelper;
protected botWeaponModLimitService: BotWeaponModLimitService;
protected botHelper: BotHelper;
protected botGeneratorHelper: BotGeneratorHelper;
protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper;
protected localisationService: LocalisationService;
protected botEquipmentModPoolService: BotEquipmentModPoolService;
protected configServer: ConfigServer;
protected botConfig: IBotConfig;
constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer);
/**
* Check mods are compatible and add to array
* @param equipment Equipment item to add mods to
* @param modPool Mod list to choose frm
* @param parentId parentid of item to add mod to
* @param parentTemplate template objet of item to add mods to
* @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type
* @param botRole the bot role being generated for
* @param forceSpawn should this mod be forced to spawn
* @returns Item + compatible mods as an array
*/
generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[];
/**
* Add mods to a weapon using the provided mod pool
* @param sessionId session id
* @param weapon Weapon to add mods to
* @param modPool Pool of compatible mods to attach to weapon
* @param weaponParentId parentId of weapon
* @param parentTemplate Weapon which mods will be generated on
* @param modSpawnChances Mod spawn chances
* @param ammoTpl Ammo tpl to use when generating magazines/cartridges
* @param botRole Role of bot weapon is generated for
* @param botLevel lvel of the bot weapon is being generated for
* @param modLimits limits placed on certian mod types per gun
* @param botEquipmentRole role of bot when accessing bot.json equipment config settings
* @returns Weapon + mods array
*/
generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string, botLevel: number, modLimits: BotModLimits, botEquipmentRole: string): Item[];
/**
* Is this modslot a front or rear sight
* @param modSlot Slot to check
* @returns true if it's a front/rear sight
*/
protected modIsFrontOrRearSight(modSlot: string): boolean;
/**
* Does the provided mod details show the mod can hold a scope
* @param modSlot e.g. mod_scope, mod_mount
* @param modsParentId Parent id of mod item
* @returns true if it can hold a scope
*/
protected modSlotCanHoldScope(modSlot: string, modsParentId: string): boolean;
/**
* Set all scope mod chances to 100%
* @param modSpawnChances Chances objet to update
*/
protected setScopeSpawnChancesToFull(modSpawnChances: ModsChances): void;
protected sortModKeys(unsortedKeys: string[]): string[];
/**
* Get a Slot property for an item (chamber/cartridge/slot)
* @param modSlot e.g patron_in_weapon
* @param parentTemplate item template
* @returns Slot item
*/
protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot;
/**
* randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot
* never return true for an item that has 0% spawn chance
* @param itemSlot slot the item sits in
* @param modSlot slot the mod sits in
* @param modSpawnChances Chances for various mod spawns
* @returns boolean true if it should spawn
*/
protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean;
/**
*
* @param modSlot Slot mod will fit into
* @param isRandomisableSlot Will generate a randomised mod pool if true
* @param modsParent Parent slot the item will be a part of
* @param botEquipBlacklist Blacklist to prevent mods from being picked
* @param itemModPool Pool of items to pick from
* @param weapon array with only weapon tpl in it, ready for mods to be added
* @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine)
* @param parentTemplate Parent item the mod will go into
* @returns ITemplateItem
*/
protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record<string, string[]>, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record<string, string[]>, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem];
/**
* Create a mod item with parameters as properties
* @param modId _id
* @param modTpl _tpl
* @param parentId parentId
* @param modSlot slotId
* @param modTemplate Used to add additional properites in the upd object
* @returns Item object
*/
protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item;
/**
* Get a list of containers that hold ammo
* e.g. mod_magazine / patron_in_weapon_000
* @returns string array
*/
protected getAmmoContainers(): string[];
/**
* Get a random mod from an items compatible mods Filter array
* @param modTpl ???? default value to return if nothing found
* @param parentSlot item mod will go into, used to get combatible items
* @param modSlot Slot to get mod to fill
* @param items items to ensure picked mod is compatible with
* @returns item tpl
*/
protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string;
/**
* Log errors if mod is not compatible with slot
* @param modToAdd template of mod to check
* @param itemSlot slot the item will be placed in
* @param modSlot slot the mod will fill
* @param parentTemplate tempalte of the mods parent item
* @returns true if valid
*/
protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean;
/**
* Find mod tpls of a provided type and add to modPool
* @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope)
* @param modTemplate db object for modItem we get compatible mods from
* @param modPool Pool of mods we are adding to
*/
protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void;
/**
* Get the possible items that fit a slot
* @param parentItemId item tpl to get compatible items for
* @param modSlot Slot item should fit in
* @param botEquipBlacklist equipment that should not be picked
* @returns array of compatible items for that slot
*/
protected getDynamicModPool(parentItemId: string, modSlot: string, botEquipBlacklist: EquipmentFilterDetails): string[];
/**
* Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist
* @param allowedMods base mods to filter
* @param botEquipBlacklist equipment blacklist
* @param modSlot slot mods belong to
* @returns Filtered array of mod tpls
*/
protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[];
/**
* With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines.
* Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0.
* Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots.
* This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine"
* @param items The items where the CylinderMagazine's camora are appended to
* @param modPool modPool which should include available cartrigdes
* @param parentId The CylinderMagazine's UID
* @param parentTemplate The CylinderMagazine's template
*/
protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void;
/**
* Take a record of camoras and merge the compatable shells into one array
* @param camorasWithShells camoras we want to merge into one array
* @returns string array of shells fro luitple camora sources
*/
protected mergeCamoraPoolsTogether(camorasWithShells: Record<string, string[]>): string[];
/**
* Filter out non-whitelisted weapon scopes
* @param weapon Weapon scopes will be added to
* @param scopes Full scope pool
* @param botWeaponSightWhitelist whitelist of scope types by weapon base type
* @returns array of scope tpls that have been filtered
*/
protected filterSightsByWeaponType(weapon: Item, scopes: string[], botWeaponSightWhitelist: Record<string, string[]>): string[];
}

View File

@ -1,25 +1,21 @@
import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper";
import { BotHelper } from "../helpers/BotHelper";
import { GameEventHelper } from "../helpers/GameEventHelper";
import { ProfileHelper } from "../helpers/ProfileHelper";
import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper";
import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase";
import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType";
import { Health, IBotType } from "../models/eft/common/tables/IBotType";
import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails";
import { IBotConfig } from "../models/spt/config/IBotConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService";
import { SeasonalEventService } from "../services/SeasonalEventService";
import { HashUtil } from "../utils/HashUtil";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil";
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,14 +24,15 @@ 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;
protected botDifficultyHelper: BotDifficultyHelper;
protected gameEventHelper: GameEventHelper;
protected seasonalEventService: SeasonalEventService;
protected configServer: ConfigServer;
protected botConfig: IBotConfig;
constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer);
constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botLevelGenerator: BotLevelGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, seasonalEventService: SeasonalEventService, configServer: ConfigServer);
/**
* Generate a player scav bot object
* @param role e.g. assault / pmcbot
@ -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
@ -99,11 +83,6 @@ export declare class BotGenerator {
*/
protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth;
protected generateSkills(skillsObj: Skills): Skills;
/**
* Iterate through bots inventory and loot to find and remove christmas items (as defined in GameEventHelper)
* @param nodeInventory Bots inventory to iterate over
*/
protected removeChristmasItemsFromBotInventory(nodeInventory: Inventory): void;
/**
* Generate a random Id for a bot and apply to bots _id and aid value
* @param bot bot to update
@ -111,12 +90,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 +97,3 @@ export declare class BotGenerator {
*/
protected generateDogtag(bot: IBotBase): IBotBase;
}
export {};

View File

@ -1,15 +1,18 @@
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 { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService";
import { LocalisationService } from "../services/LocalisationService";
import { HashUtil } from "../utils/HashUtil";
import { RandomUtil } from "../utils/RandomUtil";
import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator";
import { BotLootGenerator } from "./BotLootGenerator";
import { BotWeaponGenerator } from "./BotWeaponGenerator";
export declare class BotInventoryGenerator {
@ -20,22 +23,24 @@ export declare class BotInventoryGenerator {
protected botWeaponGenerator: BotWeaponGenerator;
protected botLootGenerator: BotLootGenerator;
protected botGeneratorHelper: BotGeneratorHelper;
protected botHelper: BotHelper;
protected weightedRandomHelper: WeightedRandomHelper;
protected localisationService: LocalisationService;
protected botEquipmentModPoolService: BotEquipmentModPoolService;
protected botEquipmentModGenerator: BotEquipmentModGenerator;
protected configServer: ConfigServer;
protected botConfig: IBotConfig;
constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer);
constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, botHelper: BotHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, botEquipmentModGenerator: BotEquipmentModGenerator, configServer: ConfigServer);
/**
* Add equipment/weapons/loot to bot
* @param sessionId Session id
* @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 +52,27 @@ 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;
/**
* Get all possible mods for item and filter down based on equipment blacklist from bot.json config
* @param itemTpl Item mod pool is being retreived and filtered
* @param equipmentBlacklist blacklist to filter mod pool with
* @returns Filtered pool of mods
*/
protected getFilteredDynamicModsForItem(itemTpl: string, equipmentBlacklist: EquipmentFilterDetails[]): Record<string, string[]>;
/**
* Work out what weapons bot should have equipped and add them to bot inventory
* @param templateInventory bot/x.json data from db
@ -58,9 +81,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 +108,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

@ -12,10 +12,12 @@ import { IBotConfig } from "../models/spt/config/IBotConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { BotWeaponModLimitService } from "../services/BotWeaponModLimitService";
import { LocalisationService } from "../services/LocalisationService";
import { HashUtil } from "../utils/HashUtil";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil";
import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator";
import { IInventoryMagGen } from "./weapongen/IInventoryMagGen";
export declare class BotWeaponGenerator {
protected jsonUtil: JsonUtil;
@ -28,11 +30,13 @@ export declare class BotWeaponGenerator {
protected randomUtil: RandomUtil;
protected configServer: ConfigServer;
protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper;
protected botWeaponModLimitService: BotWeaponModLimitService;
protected botEquipmentModGenerator: BotEquipmentModGenerator;
protected localisationService: LocalisationService;
protected inventoryMagGenComponents: IInventoryMagGen[];
protected readonly modMagazineSlotId = "mod_magazine";
protected botConfig: IBotConfig;
constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]);
constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botWeaponModLimitService: BotWeaponModLimitService, botEquipmentModGenerator: BotEquipmentModGenerator, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]);
/**
* Pick a random weapon based on weightings and generate a functional weapon
* @param equipmentSlot Primary/secondary/holster
@ -43,7 +47,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 +66,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

@ -1,5 +1,4 @@
import { ContainerHelper } from "../helpers/ContainerHelper";
import { GameEventHelper } from "../helpers/GameEventHelper";
import { ItemHelper } from "../helpers/ItemHelper";
import { PresetHelper } from "../helpers/PresetHelper";
import { RagfairServerHelper } from "../helpers/RagfairServerHelper";
@ -9,6 +8,8 @@ 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 { SeasonalEventService } from "../services/SeasonalEventService";
import { JsonUtil } from "../utils/JsonUtil";
import { MathUtil } from "../utils/MathUtil";
import { ObjectId } from "../utils/ObjectId";
@ -26,12 +27,13 @@ export declare class LocationGenerator {
protected ragfairServerHelper: RagfairServerHelper;
protected itemHelper: ItemHelper;
protected mathUtil: MathUtil;
protected gameEventHelper: GameEventHelper;
protected seasonalEventService: SeasonalEventService;
protected containerHelper: ContainerHelper;
protected presetHelper: PresetHelper;
protected localisationService: LocalisationService;
protected configServer: ConfigServer;
protected locationConfig: ILocationConfig;
constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, gameEventHelper: GameEventHelper, containerHelper: ContainerHelper, presetHelper: PresetHelper, configServer: ConfigServer);
constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer);
generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record<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
@ -110,7 +119,7 @@ export declare class RagfairOfferGenerator {
*/
protected createBarterRequirement(offerItems: Item[]): IBarterScheme[];
/**
* Get an array of flea prices + item tpl, cached in generator class
* Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter`
* @returns array with tpl/price values
*/
protected getFleaPricesAsArray(): {

View File

@ -37,12 +37,6 @@ export declare class ScavCaseRewardGenerator {
* @returns filtered array of db items
*/
protected getDbItems(): ITemplateItem[];
/**
* Check if a template id has a blacklisted parent id
* @param tplid template id to check
* @returns true if item is blacklisted
*/
protected itemHasBlacklistedParent(tplid: string): boolean;
/**
* Pick a number of items to be rewards, the count is defined by the values in
* @param items item pool to pick rewards from

View File

@ -2,14 +2,16 @@ import { IPmcData } from "../models/eft/common/IPmcData";
import { ITraderAssort } from "../models/eft/common/tables/ITrader";
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer";
import { LocalisationService } from "../services/LocalisationService";
import { ItemHelper } from "./ItemHelper";
import { QuestHelper } from "./QuestHelper";
export declare class AssortHelper {
protected logger: ILogger;
protected itemHelper: ItemHelper;
protected databaseServer: DatabaseServer;
protected localisationService: LocalisationService;
protected questHelper: QuestHelper;
constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, questHelper: QuestHelper);
constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper);
/**
* Remove assorts from a trader that have not been unlocked yet
* @param pmcProfile player profile

View File

@ -1,204 +1,24 @@
import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper";
import { Mods, ModsChances } from "../models/eft/common/tables/IBotType";
import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem";
import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem";
import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { EquipmentFilters, IBotConfig } from "../models/spt/config/IBotConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService";
import { ItemFilterService } from "../services/ItemFilterService";
import { LocalisationService } from "../services/LocalisationService";
import { HashUtil } from "../utils/HashUtil";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil";
import { BotWeaponGeneratorHelper } from "./BotWeaponGeneratorHelper";
import { ContainerHelper } from "./ContainerHelper";
import { InventoryHelper } from "./InventoryHelper";
import { ItemHelper } from "./ItemHelper";
import { ProbabilityHelper } from "./ProbabilityHelper";
import { ProfileHelper } from "./ProfileHelper";
export declare class BotModLimits {
scope: ItemCount;
scopeMax: number;
scopeBaseTypes: string[];
flashlightLaser: ItemCount;
flashlightLaserMax: number;
flashlgihtLaserBaseTypes: string[];
}
export declare class ItemCount {
count: number;
}
export declare class BotGeneratorHelper {
protected logger: ILogger;
protected jsonUtil: JsonUtil;
protected hashUtil: HashUtil;
protected randomUtil: RandomUtil;
protected probabilityHelper: ProbabilityHelper;
protected databaseServer: DatabaseServer;
protected durabilityLimitsHelper: DurabilityLimitsHelper;
protected itemHelper: ItemHelper;
protected inventoryHelper: InventoryHelper;
protected containerHelper: ContainerHelper;
protected botEquipmentFilterService: BotEquipmentFilterService;
protected itemFilterService: ItemFilterService;
protected profileHelper: ProfileHelper;
protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper;
protected 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);
/**
* Check mods are compatible and add to array
* @param equipment Equipment item to add mods to
* @param modPool Mod list to choose frm
* @param parentId parentid of item to add mod to
* @param parentTemplate template objet of item to add mods to
* @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type
* @param botRole the bot role being generated for
* @param forceSpawn should this mod be forced to spawn
* @returns Item + compatible mods as an array
*/
generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[];
/**
* @param sessionId session id
* @param weapon Weapon to add mods to
* @param modPool Pool of compatible mods to attach to weapon
* @param weaponParentId parentId of weapon
* @param parentWeaponTemplate Weapon which mods will be generated on
* @param modSpawnChances Mod spawn chances
* @param ammoTpl Ammo tpl to use when generating magazines/cartridges
* @param botRole Role of bot weapon is generated for
* @returns Weapon + mods array
*/
generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[];
/**
*
* @param modSlot Slot mod will fit into
* @param isRandomisableSlot Will generate a randomised mod pool if true
* @param modsParent Parent slot the item will be a part of
* @param botEquipBlacklist Blacklist to prevent mods from being picked
* @param itemModPool Pool of items to pick from
* @param weapon array with only weapon tpl in it, ready for mods to be added
* @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine)
* @param parentTemplate Parent item the mod will go into
* @returns ITemplateItem
*/
protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record<string, string[]>, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem];
/**
* Find mod tpls of a provided type and add to modPool
* @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope)
* @param modTemplate db object for modItem we get compatible mods from
* @param modPool Pool of mods we are adding to
*/
protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void;
/**
* Check if mod item is on limited list + has surpassed the limit set for it
* @param botRole role the bot has e.g. assault
* @param modTemplate mods template data
* @param modLimits limits set for weapon being generated for this bot
* @returns true if over item limit
*/
protected modHasReachedItemLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits): boolean;
/**
* Initalise mod limits to be used when generating a weapon
* @param botRole "assault", "bossTagilla" or "pmc"
* @returns BotModLimits object
*/
protected initModLimits(botRole: string): BotModLimits;
/**
* Generate a pool of mods for this bots mod type if bot has values inside `randomisedWeaponModSlots` array found in bot.json/equipment[botrole]
* @param allowedMods Mods to be added to mod pool
* @param botEquipBlacklist blacklist of items not allowed to be added to mod pool
* @param modSlot Slot to generate mods for
* @param itemModPool base mod pool to replace values of
*/
protected generateDynamicWeaponModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record<string, string[]>): void;
/**
* Find all compatible mods for equipment item and add to modPool
* @param itemDetails item to find mods for
* @param modPool ModPool to add mods to
* @param equipmentBlacklist equipment not allowed to be used by the bot
* @param botEquipmentRole bot type to generate pool for (e.g. assault, pmcBot, pmc for usec/bear)
*/
generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods, equipmentBlacklist: EquipmentFilterDetails[], botEquipmentRole: string): void;
/**
* Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist
* @param allowedMods base mods to filter
* @param botEquipBlacklist equipment blacklist
* @param modSlot slot mods belong to
* @returns Filtered array of mod tpls
*/
protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[];
/**
* Check if the specific item type on the weapon has reached the set limit
* @param modTpl log mod tpl if over type limit
* @param currentCount current number of this item on gun
* @param maxLimit mod limit allowed
* @param botRole role of bot we're checking weapon of
* @returns true if limit reached
*/
protected weaponModLimitReached(modTpl: string, currentCount: {
count: number;
}, maxLimit: number, botRole: string): boolean;
/**
* Log errors if mod is not compatible with slot
* @param modToAdd template of mod to check
* @param itemSlot slot the item will be placed in
* @param modSlot slot the mod will fill
* @param parentTemplate tempalte of the mods parent item
* @returns true if valid
*/
protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean;
/**
* Create a mod item with parameters as properties
* @param modId _id
* @param modTpl _tpl
* @param parentId parentId
* @param modSlot slotId
* @param modTemplate Used to add additional properites in the upd object
* @returns Item object
*/
protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item;
/**
* randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot
* never return true for an item that has 0% spawn chance
* @param itemSlot slot the item sits in
* @param modSlot slot the mod sits in
* @param modSpawnChances Chances for various mod spawns
* @returns boolean true if it should spawn
*/
protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean;
/**
* Get a list of containers that hold ammo
* e.g. mod_magazine / patron_in_weapon_000
* @returns string array
*/
protected getAmmoContainers(): string[];
/**
* Get a Slot property for an item (chamber/cartridge/slot)
* @param modSlot e.g patron_in_weapon
* @param parentTemplate item template
* @returns Slot item
*/
protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot;
/**
* With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines.
* Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0.
* Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots.
* This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine"
* @param items The items where the CylinderMagazine's camora are appended to
* @param modPool modPool which should include available cartrigdes
* @param parentId The CylinderMagazine's UID
* @param parentTemplate The CylinderMagazine's template
*/
protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void;
/**
* Take a record of camoras and merge the compatable shells into one array
* @param camorasWithShells camoras we want to merge into one array
* @returns string array of shells fro luitple camora sources
*/
protected mergeCamoraPoolsTogether(camorasWithShells: Record<string, string[]>): string[];
constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, localisationService: LocalisationService, configServer: ConfigServer);
/**
* Adds properties to an item
* e.g. Repairable / HasHinge / Foldable / MaxDurability
@ -209,6 +29,14 @@ export declare class BotGeneratorHelper {
generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): {
upd?: Upd;
};
/**
* Get the chance for the weapon attachment or helmet equipment to be set as activated
* @param botRole role of bot with weapon/helmet
* @param setting the setting of the weapon attachment/helmet equipment to be activated
* @param defaultValue default value for the chance of activation if the botrole or bot equipment role is null
* @returns Percent chance to be active
*/
protected getBotEquipmentSettingFromConfig(botRole: string, setting: keyof EquipmentFilters, defaultValue: number): number;
/**
* Create a repairable object for a weapon that containers durability + max durability properties
* @param itemTemplate weapon object being generated for
@ -224,22 +52,16 @@ export declare class BotGeneratorHelper {
*/
protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable;
/**
* Get a random mod from an items compatible mods Filter array
* @param modTpl ????
* @param parentSlot item mod will go into, used to get combatible items
* @param modSlot Slot to get mod to fill
* @param items items to ensure picked mod is compatible with
* @returns item tpl
*/
protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string;
/**
* Can an item be added to an item without issue
* @param items items to check compatiblilities with
* @param tplToCheck tpl of the item to check for incompatibilities
* Can item be added to another item without conflict
* @param items Items to check compatiblilities with
* @param tplToCheck Tpl of the item to check for incompatibilities
* @param equipmentSlot Slot the item will be placed into
* @returns false if no incompatibilties
* @returns false if no incompatibilties, also has incompatibility reason
*/
isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean;
isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): {
incompatible: boolean;
reason: string;
};
/**
* Convert a bots role to the equipment role used in config/bot.json
* @param botRole Role to convert

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

@ -1,4 +1,4 @@
import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig";
import { ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
export declare class GameEventHelper {
@ -6,24 +6,4 @@ export declare class GameEventHelper {
protected configServer: ConfigServer;
protected seasonalEventConfig: ISeasonalEventConfig;
constructor(databaseServer: DatabaseServer, configServer: ConfigServer);
get events(): Record<string, string>;
get christmasEventItems(): string[];
itemIsChristmasRelated(itemId: string): boolean;
christmasEventEnabled(): boolean;
/**
* Get the dates each seasonal event starts and ends
* @returns Record with event name + start/end date
*/
getEventDetails(): ISeasonalEvent[];
/**
* Is detection of seasonal events enabled (halloween / christmas)
* @returns true if seasonal events should be checked for
*/
isAutomaticEventDetectionEnabled(): boolean;
/**
* Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween
* @param eventName Name of event to get gear changes for
* @returns bots with equipment changes
*/
getEventBotGear(eventName: string): Record<string, Record<string, Record<string, number>>>;
}

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;
@ -35,18 +36,18 @@ export declare class HandbookHelper {
isCategory(category: string): boolean;
childrenCategories(x: string): string[];
/**
* Convert currency into roubles
* @param {number} value
* @param {string} currencyFrom
* @returns get rouble value of inputted currency
*/
inRUB(value: number, currencyFrom: string): number;
/**
* Gets Ruble to Currency conversion Value
* @param {number} value
* @param {string} currencyTo
* @returns number
* Convert non-roubles into roubles
* @param nonRoubleCurrencyCount Currency count to convert
* @param currencyTypeFrom What current currency is
* @returns Count in roubles
*/
fromRUB(value: number, currencyTo: string): number;
inRUB(nonRoubleCurrencyCount: number, currencyTypeFrom: string): number;
/**
* Convert roubles into another currency
* @param roubleCurrencyCount roubles to convert
* @param currencyTypeTo Currency to convert roubles into
* @returns currency count in desired type
*/
fromRUB(roubleCurrencyCount: number, currencyTypeTo: string): number;
}
export {};

View File

@ -1,4 +1,5 @@
import { IPmcData } from "../models/eft/common/IPmcData";
import { Effect } from "../models/eft/health/Effect";
import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData";
import { IAkiProfile } from "../models/eft/profile/IAkiProfile";
import { IHealthConfig } from "../models/spt/config/IHealthConfig";
@ -46,6 +47,6 @@ export declare class HealthHelper {
* @param effectBodyPart body part to edit
* @param effectType Effect to add to body part
*/
protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: string): void;
protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: Effect): void;
protected isEmpty(map: any): boolean;
}

View File

@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer";
import { LocalisationService } from "../services/LocalisationService";
import { ProfileFixerService } from "../services/ProfileFixerService";
import { JsonUtil } from "../utils/JsonUtil";
import { InventoryHelper } from "./InventoryHelper";
@ -16,8 +17,9 @@ export declare class InRaidHelper {
protected databaseServer: DatabaseServer;
protected inventoryHelper: InventoryHelper;
protected paymentHelper: PaymentHelper;
protected localisationService: LocalisationService;
protected profileFixerService: ProfileFixerService;
constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService);
constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService);
/**
* Check an array of items and add an upd object to money items with a stack count of 1
* Single stack money items have no upd object and thus no StackObjectsCount, causing issues

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
@ -31,10 +37,17 @@ declare class ItemHelper {
* Check if the tpl / template Id provided is a descendent of the baseclass
*
* @param {string} tpl the item template id to check
* @param {string} baseclassTpl the baseclass to check for
* @param {string} baseClassTpl the baseclass to check for
* @return {boolean} is the tpl a descendent?
*/
isOfBaseclass(tpl: string, baseclassTpl: string): boolean;
isOfBaseclass(tpl: string, baseClassTpl: string): boolean;
/**
* Check if item has any of the supplied base clases
* @param tpl Item to check base classes of
* @param baseClassTpls base classes to check for
* @returns true if any supplied base classes match
*/
isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean;
/**
* Returns the item price based on the handbook or as a fallback from the prices.json if the item is not
* found in the handbook. If the price can't be found at all return 0
@ -179,7 +192,7 @@ declare class ItemHelper {
*/
replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): any[];
/**
* Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do
* WARNING, SLOW. Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do
* @param {string} tpl
* @param {Array} tplsToCheck
* @returns boolean

View File

@ -5,8 +5,10 @@ export declare class PresetHelper {
protected jsonUtil: JsonUtil;
protected databaseServer: DatabaseServer;
protected lookup: Record<string, string[]>;
protected defaultPresets: Record<string, Preset>;
constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer);
hydratePresetStore(input: Record<string, string[]>): void;
getDefaultPresets(): Record<string, Preset>;
isPreset(id: string): boolean;
hasPreset(templateId: string): boolean;
getPreset(id: string): Preset;

View File

@ -5,7 +5,6 @@ import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNic
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer";
import { FenceService } from "../services/FenceService";
import { ProfileSnapshotService } from "../services/ProfileSnapshotService";
import { JsonUtil } from "../utils/JsonUtil";
import { TimeUtil } from "../utils/TimeUtil";
@ -20,9 +19,13 @@ export declare class ProfileHelper {
protected databaseServer: DatabaseServer;
protected itemHelper: ItemHelper;
protected profileSnapshotService: ProfileSnapshotService;
protected fenceService: FenceService;
constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService);
constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService);
resetProfileQuestCondition(sessionID: string, conditionId: string): void;
/**
* Get all profiles from server
* @returns Dictionary of profiles
*/
getProfiles(): Record<string, IAkiProfile>;
getCompleteProfile(sessionID: string): IPmcData[];
/**
* Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen

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
@ -66,12 +68,12 @@ export declare class QuestHelper {
* @param progressAmount Amount of skill points to add to skill
*/
rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void;
getQuestLocale(questId: string): any;
/**
* Debug Routine for showing some information on the
* quest list in question.
* Get quest name by quest id
* @param questId id to get
* @returns
*/
dumpQuests(quests: any): void;
getQuestNameFromLocale(questId: string): string;
/**
* Check if trader has sufficient loyalty to fullfill quest requirement
* @param questProperties Quest props

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

@ -11,7 +11,21 @@ export declare class RagfairSellHelper {
protected configServer: ConfigServer;
protected ragfairConfig: IRagfairConfig;
constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer);
calculateSellChance(baseChancePercent: number, offerPriceRub: number, playerListedPriceRub: number): number;
/**
* Get the percent chance to sell an item based on its average listed price vs player chosen listing price
* @param baseChancePercent Base chance to sell item
* @param averageOfferPriceRub Price of average offer in roubles
* @param playerListedPriceRub Price player listed item for in roubles
* @returns percent value
*/
calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number;
/**
* Get percent chance to sell an item when price is below items average listing price
* @param playerListedPriceRub Price player listed item for in roubles
* @param averageOfferPriceRub Price of average offer in roubles
* @returns percent value
*/
protected getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub: number, playerListedPriceRub: number): number;
/**
* Determine if the offer being listed will be sold
* @param sellChancePercent chance item will sell

View File

@ -42,7 +42,7 @@ export declare class RagfairServerHelper {
protected isItemBlacklisted(itemTemplateId: string): boolean;
isTrader(userID: string): boolean;
isPlayer(userID: string): boolean;
returnItems(sessionID: string, items: any[]): void;
returnItems(sessionID: string, items: Item[]): void;
calculateDynamicStackCount(tplId: string, isWeaponPreset: boolean): number;
/**
* Choose a currency at random with bias

View File

@ -15,7 +15,7 @@ export declare class RepairHelper {
protected repairConfig: IRepairConfig;
constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer);
/**
*
* Alter an items durability after a repair by trader/repair kit
* @param itemToRepair item to update durability details
* @param itemToRepairDetails db details of item to repair
* @param isArmor Is item being repaired a piece of armor

View File

@ -6,8 +6,10 @@ import { Item, Upd } from "../models/eft/common/tables/IItem";
import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse";
import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData";
import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTradeRequestData";
import { ITraderConfig } from "../models/spt/config/ITraderConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { EventOutputHolder } from "../routers/EventOutputHolder";
import { ConfigServer } from "../servers/ConfigServer";
import { RagfairServer } from "../servers/RagfairServer";
import { FenceService } from "../services/FenceService";
import { PaymentService } from "../services/PaymentService";
@ -20,7 +22,9 @@ export declare class TradeHelper {
protected fenceService: FenceService;
protected inventoryHelper: InventoryHelper;
protected ragfairServer: RagfairServer;
constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer);
protected configServer: ConfigServer;
protected traderConfig: ITraderConfig;
constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer);
/**
* Buy item from flea or trader
* @param pmcData
@ -33,7 +37,7 @@ export declare class TradeHelper {
buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse;
/**
* Sell item to trader
* @param pmcData
* @param pmcData Profile to update
* @param body
* @param sessionID
* @returns

View File

@ -7,7 +7,9 @@ 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 { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService";
import { JsonUtil } from "../utils/JsonUtil";
import { MathUtil } from "../utils/MathUtil";
import { TimeUtil } from "../utils/TimeUtil";
@ -27,11 +29,13 @@ export declare class TraderAssortHelper {
protected ragfairAssortGenerator: RagfairAssortGenerator;
protected ragfairOfferGenerator: RagfairOfferGenerator;
protected traderAssortService: TraderAssortService;
protected localisationService: LocalisationService;
protected traderPurchasePersisterService: TraderPurchasePersisterService;
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, traderPurchasePersisterService: TraderPurchasePersisterService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer);
/**
* Get a traders assorts
* Can be used for returning ragfair / fence assorts

View File

@ -8,6 +8,7 @@ import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer";
import { FenceService } from "../services/FenceService";
import { LocalisationService } from "../services/LocalisationService";
import { PlayerService } from "../services/PlayerService";
import { TimeUtil } from "../utils/TimeUtil";
import { HandbookHelper } from "./HandbookHelper";
@ -23,11 +24,12 @@ export declare class TraderHelper {
protected itemHelper: ItemHelper;
protected handbookHelper: HandbookHelper;
protected playerService: PlayerService;
protected localisationService: LocalisationService;
protected fenceService: FenceService;
protected timeUtil: TimeUtil;
protected configServer: ConfigServer;
protected traderConfig: ITraderConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer);
constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer);
getTrader(traderID: string, sessionID: string): ITraderBase;
getTraderAssortsById(traderId: string): ITraderAssort;
/**
@ -53,19 +55,26 @@ export declare class TraderHelper {
getPurchasesData(traderID: string, sessionID: string): Record<string, IBarterScheme[][]>;
/**
* Should item be skipped when selling to trader according to its sell categories and other checks
* @param pmcData
* @param item
* @param sellCategory
* @param pmcData Profile
* @param item Item to be checked is sellable to trader
* @param sellCategory categories trader will buy
* @param traderId Trader item is being checked can be sold to
* @returns true if should NOT be sold to trader
*/
protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[]): boolean;
protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[], traderId: string): boolean;
/**
* Can this weapon be sold to a trader with its current durabiltiy level
* @param traderID
* @param item
* @returns boolean
* Check if item has durability so low it precludes it from being sold to the trader (inclusive)
* @param item Item to check durability of
* @param traderId Trader item is sold to
* @returns
*/
protected isWeaponBelowTraderBuyDurability(traderID: string, item: Item): boolean;
protected itemIsBelowSellableDurabilityThreshhold(item: Item, traderId: string): boolean;
/**
* Get the percentage threshold value a trader will buy armor/weapons above
* @param traderId Trader to look up
* @returns percentage
*/
protected getTraderDurabiltyPurchaseThreshold(traderId: string): number;
/**
* Get the price of an item and all of its attached children
* Take into account bonuses/adjsutments e.g. discounts
@ -113,10 +122,22 @@ export declare class TraderHelper {
getTraderUpdateSeconds(traderId: string): number;
/**
* check if an item is allowed to be sold to a trader
* @param traderFilters array of allowed categories
* @param categoriesTraderBuys array of allowed categories
* @param tplToCheck itemTpl of inventory
* @returns boolean
* @returns boolean if item can be sold to trader
*/
traderFilter(traderFilters: string[], tplToCheck: string): boolean;
doesTraderBuyItem(categoriesTraderBuys: string[], tplToCheck: string): boolean;
getLoyaltyLevel(traderID: string, pmcData: IPmcData): LoyaltyLevel;
/**
* Store the purchase of an assort from a trader in the player profile
* @param sessionID Session id
* @param newPurchaseDetails New item assort id + count
*/
addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: {
items: {
item_id: string;
count: number;
}[];
tid: string;
}): void;
}

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

@ -34,6 +34,7 @@ export declare class PreAkiModLoader implements IModLoader {
* @returns Array of mod names in load order
*/
getImportedModsNames(): string[];
getImportedModDetails(): Record<string, ModLoader.IMod>;
getModPath(mod: string): string;
protected importClass(name: string, filepath: string, container: DependencyContainer): void;
protected importMods(): Promise<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

@ -57,6 +57,10 @@ export interface ModsChances {
mod_pistol_grip: number;
mod_reciever: number;
mod_scope: number;
mod_scope_000: number;
mod_scope_001: number;
mod_scope_002: number;
mod_scope_003: number;
mod_sight_front: number;
mod_sight_rear: number;
mod_stock: number;
@ -152,4 +156,4 @@ export interface Items {
SpecialLoot: string[];
TacticalVest: string[];
}
export declare type Mods = Record<string, Record<string, string[]>>;
export type Mods = Record<string, Record<string, 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

@ -25,7 +25,7 @@ export interface IPmcDataRepeatableQuest {
endTime: number;
changeRequirement: TChangeRequirementRecord;
}
export declare type TChangeRequirementRecord = Record<string, IChangeRequirement>;
export type TChangeRequirementRecord = Record<string, IChangeRequirement>;
export interface IChangeRequirement {
changeCost: IChangeCost[];
changeStandingCost: number;

View File

@ -54,8 +54,9 @@ export interface Repair {
currency: string;
currency_coefficient: number;
excluded_category: string[];
/** Doesn't exist in client object */
excluded_id_list: any[];
quality: string;
quality: number;
}
export interface ITraderAssort {
nextResupply: number;

View File

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

View File

@ -0,0 +1,16 @@
export interface IChatServer {
_id: string;
RegistrationId: number;
VersionId: string;
Ip: string;
Port: number;
DateTime: number;
Chats: IChat[];
Regions: string[];
/** Possibly removed */
IsDeveloper?: boolean;
}
export interface IChat {
_id: string;
Members: number;
}

View File

@ -1,7 +1,7 @@
import { MemberCategory } from "../../enums/MemberCategory";
export interface IGetFriendListDataResponse {
Friends: Friend[];
Ignore: any[];
Ignore: string[];
InIgnoreList: string[];
}
export interface Friend {

View File

@ -7,11 +7,13 @@ export interface IGameConfigResponse {
activeProfileId: string;
backend: Backend;
utc_time: number;
/** Total in game time */
totalInGame: number;
reportAvailable: boolean;
twitchEventMember: boolean;
}
export interface Backend {
Lobby: string;
Trading: string;
Messaging: string;
Main: string;

View File

@ -3,7 +3,7 @@ export interface IHideoutProduction {
areaType: number;
requirements: Requirement[];
productionTime: number;
boosters: any;
boosters?: any;
endProduct: string;
continuous: boolean;
count: number;

View File

@ -1 +1 @@
export declare type IGetInsuranceCostResponseData = Record<string, Record<string, number>>;
export type IGetInsuranceCostResponseData = Record<string, Record<string, number>>;

View File

@ -1,4 +1,9 @@
export interface IAddItemRequestData {
tid: string;
items: any[];
items: AddItem[];
}
export interface AddItem {
count: number;
isPreset?: boolean;
item_id: string;
}

View File

@ -16,7 +16,7 @@ export interface ToLocation {
export interface Container {
id: string;
container: string;
location: Location | number;
location?: Location | number;
}
export interface Location {
x: number;

View File

@ -7,7 +7,7 @@ export interface IItemEventRouterBase {
warnings: Warning[];
profileChanges: TProfileChanges | "";
}
export declare type TProfileChanges = Record<string, ProfileChange>;
export type TProfileChanges = Record<string, ProfileChange>;
export interface Warning {
index: number;
errmsg: string;

View File

@ -1,2 +1,2 @@
import { ILoginRequestData } from "./ILoginRequestData";
export declare type IRemoveProfileData = ILoginRequestData;
export type IRemoveProfileData = ILoginRequestData;

View File

@ -11,6 +11,12 @@ export interface IAkiProfile {
vitality: Vitality;
inraid: Inraid;
insurance: Insurance[];
/** Assort purchases made by player since last trader refresh */
traderPurchases?: Record<string, Record<string, TraderPurchaseData>>;
}
export declare class TraderPurchaseData {
count: number;
purchaseTimestamp: number;
}
export interface Info {
id: string;
@ -93,6 +99,13 @@ export interface DateTime {
}
export interface Aki {
version: string;
mods?: ModDetails[];
}
export interface ModDetails {
name: string;
version: string;
author: string;
dateAdded: number;
}
export interface Vitality {
health: Health;

View File

@ -8,6 +8,8 @@ export declare enum BaseClasses {
BACKPACK = "5448e53e4bdc2d60728b4567",
VISORS = "5448e5724bdc2ddf718b4568",
FOOD = "5448e8d04bdc2ddf718b4569",
GAS_BLOCK = "56ea9461d2720b67698b456f",
RAIL_COVER = "55818b1d4bdc2d5b648b4572",
DRINK = "5448e8d64bdc2dce718b4568",
BARTER_ITEM = "5448eb774bdc2d0a728b4567",
INFO = "5448ecbe4bdc2d60728b4568",
@ -36,6 +38,7 @@ export declare enum BaseClasses {
THROW_WEAPON = "543be6564bdc2df4348b4568",
FOOD_DRINK = "543be6674bdc2df1348b4569",
PISTOL = "5447b5cf4bdc2d65278b4567",
REVOLVER = "617f1ef5e8b54b0998387733",
SMG = "5447b5e04bdc2d62278b4567",
ASSAULT_RIFLE = "5447b5f14bdc2d61278b4567",
ASSAULT_CARBINE = "5447b5fc4bdc2d87278b4567",
@ -73,9 +76,10 @@ export declare enum BaseClasses {
TACTICAL_COMBO = "55818b164bdc2ddc698b456c",
FLASHLIGHT = "55818b084bdc2d5b648b4571",
MAGAZINE = "5448bc234bdc2d3c308b4569",
LIGHT_LASER = "55818b0e4bdc2dde698b456e",
LIGHT_LASER_DESIGNATOR = "55818b0e4bdc2dde698b456e",
FLASH_HIDER = "550aa4bf4bdc2dd6348b456b",
COLLIMATOR = "55818ad54bdc2ddc698b4569",
IRON_SIGHT = "55818ac54bdc2d5b648b456e",
COMPACT_COLLIMATOR = "55818acf4bdc2dde698b456b",
COMPENSATOR = "550aa4af4bdc2dd4348b456e",
OPTIC_SCOPE = "55818ae44bdc2dde698b456c",

View File

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

View File

@ -1,6 +1,6 @@
/// <reference types="node" />
import { IncomingMessage, ServerResponse } from "http";
export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void;
export type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void;
/**
* Associates handlers, HTTP methods and a base url to a listener using a proxy
* @param basePath The base path

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

@ -6,7 +6,6 @@ import { IHideoutProduction } from "../../eft/hideout/IHideoutProduction";
import { IHideoutScavCase } from "../../eft/hideout/IHideoutScavCase";
import { IHideoutSettingsBase } from "../../eft/hideout/IHideoutSettingsBase";
import { IGetBodyResponseData } from "../../eft/httpResponse/IGetBodyResponseData";
import { ILanguageBase } from "../server/ILocaleBase";
import { ISettingsBase } from "../server/ISettingsBase";
export interface IDataCallbacks {
getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ISettingsBase>;
@ -20,7 +19,7 @@ export interface IDataCallbacks {
getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IHideoutArea[]>;
gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IHideoutProduction[]>;
getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IHideoutScavCase[]>;
getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ILanguageBase[]>;
getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<Record<string, string>>;
getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<any>;
getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string;
}

View File

@ -66,10 +66,11 @@ export interface LootNvalue {
}
export interface EquipmentFilters {
weaponModLimits: ModLimits;
randomisedWeaponModSlots?: string[];
randomisedArmorSlots?: string[];
weaponSightWhitelist: Record<string, string[]>;
faceShieldIsActiveChancePercent?: number;
lightLaserIsActiveChancePercent?: number;
nvgIsActiveChancePercent?: number;
randomisation: RandomisationDetails[];
blacklist: EquipmentFilterDetails[];
whitelist: EquipmentFilterDetails[];
clothing: WeightingAdjustmentDetails[];
@ -81,6 +82,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 +98,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

@ -4,6 +4,7 @@ export interface IQuestConfig extends IBaseConfig {
kind: "aki-quest";
redeemTime: number;
repeatableQuests: IRepeatableQuestConfig[];
locationIdMap: Record<string, string>;
bearOnlyQuests: string[];
usecOnlyQuests: string[];
}

View File

@ -1,10 +1,13 @@
import { MinMax } from "../../../models/common/MinMax";
import { IBaseConfig } from "./IBaseConfig";
export interface ITraderConfig extends IBaseConfig {
kind: "aki-trader";
updateTime: UpdateTime[];
updateTimeDefault: number;
/** What % of max durability an item needs to sell to a trader*/
durabilityPurchaseThreshhold: Record<string, number>;
traderPriceMultipler: number;
minDurabilityForSale: number;
persistPurchaseDataInProfile: boolean;
fence: FenceConfig;
}
export interface UpdateTime {
@ -17,6 +20,8 @@ export interface FenceConfig {
assortSize: number;
maxPresetsPercent: number;
presetPriceMult: number;
armorMaxDurabilityPercentMinMax: MinMax;
presetMaxDurabilityPercentMinMax: MinMax;
itemPriceMult: number;
regenerateAssortsOnRefresh: boolean;
itemTypeLimits: Record<string, number>;

View File

@ -1,49 +1,5 @@
export interface ILocaleBase {
global: Record<string, ILocaleGlobalBase>;
global: Record<string, Record<string, string>>;
menu: Record<string, string>;
languages: ILanguageBase[];
}
export interface ILocaleGlobalBase {
interface: Record<string, string>;
enum: any[];
mail: Record<string, string>;
quest: Record<string, ILocaleQuest>;
preset: Record<string, ILocalePreset>;
handbook: Record<string, string>;
season: Record<string, string>;
customization: Record<string, ILocaleProps>;
repeatableQuest: Record<string, string>;
templates: Record<string, ILocaleProps>;
locations: Record<string, ILocaleProps>;
banners: Record<string, ILocaleProps>;
trading: Record<string, ILocaleTradingProps>;
}
export interface ILocaleQuest {
name: string;
description: string;
note: string;
failMessageText: string;
startedMessageText: string;
successMessageText: string;
conditions: Record<string, string>;
location: string;
}
export interface ILocalePreset {
Name: string;
}
export interface ILocaleProps {
Name: string;
ShortName: string;
Description: string;
}
export interface ILocaleTradingProps {
FullName: string;
FirstName: string;
Nickname: string;
Location: string;
Description: string;
}
export interface ILanguageBase {
ShortName: string;
Name: string;
languages: Record<string, string>;
}

View File

@ -11,6 +11,7 @@ export interface Config {
FramerateLimit: FramerateLimit;
GroupStatusInterval: number;
KeepAliveInterval: number;
LobbyKeepAliveInterval: number;
Mark502and504AsNonImportant: boolean;
MemoryManagementSettings: MemoryManagementSettings;
NVidiaHighlights: boolean;
@ -18,7 +19,10 @@ export interface Config {
PingServerResultSendInterval: number;
PingServersInterval: number;
ReleaseProfiler: ReleaseProfiler;
RequestConfirmationTimeouts: number[];
RequestsMadeThroughLobby: string[];
SecondCycleDelaySeconds: number;
ShouldEstablishLobbyConnection: boolean;
TurnOffLogging: boolean;
WeaponOverlapDistanceCulling: number;
WebDiagnosticsEnabled: boolean;

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,41 @@
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 equipment settings for bot
* @param botEquipmentRole equipment role to return
* @returns EquipmentFilters object
*/
getBotEquipmentSettings(botEquipmentRole: string): EquipmentFilters;
/**
* Get weapon sight whitelist for a specific bot type
* @param botEquipmentRole equipment role of bot to look up
* @returns Dictionary of weapon type and their whitelisted scope types
*/
getBotWeaponSightWhitelist(botEquipmentRole: string): Record<string, string[]>;
/**
* 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 +86,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

@ -0,0 +1,65 @@
import { ItemHelper } from "../helpers/ItemHelper";
import { Mods } from "../models/eft/common/tables/IBotType";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { IBotConfig } from "../models/spt/config/IBotConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { VFS } from "../utils/VFS";
/** Store a mapping between weapons, their slots and the items that fit those slots */
export declare class BotEquipmentModPoolService {
protected logger: ILogger;
protected vfs: VFS;
protected itemHelper: ItemHelper;
protected databaseServer: DatabaseServer;
protected configServer: ConfigServer;
protected botConfig: IBotConfig;
protected weaponModPool: Mods;
protected gearModPool: Mods;
protected weaponPoolGenerated: boolean;
protected armorPoolGenerated: boolean;
constructor(logger: ILogger, vfs: VFS, itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer);
/**
* Store dictionary of mods for each item passed in
* @param items items to find related mods and store in modPool
*/
protected generatePool(items: ITemplateItem[], poolType: string): void;
/**
* Empty the mod pool
*/
resetPool(): void;
/**
* Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already)
* @param itemTpl item to look up
* @param slotName slot to get compatible mods for
* @returns tpls that fit the slot
*/
getCompatibleModsForWeaponSlot(itemTpl: string, slotName: string): string[];
/**
* Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already)
* @param itemTpl item to look up
* @param slotName slot to get compatible mods for
* @returns tpls that fit the slot
*/
getCompatibleModsFoGearSlot(itemTpl: string, slotName: string): string[];
/**
* Get mods for a piece of gear by its tpl
* @param itemTpl items tpl to look up mods for
* @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value
*/
getModsForGearSlot(itemTpl: string): Record<string, string[]>;
/**
* Get mods for a weapon by its tpl
* @param itemTpl Weapons tpl to look up mods for
* @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value
*/
getModsForWeaponSlot(itemTpl: string): Record<string, string[]>;
/**
* Create weapon mod pool and set generated flag to true
*/
protected generateWeaponPool(): void;
/**
* Create gear mod pool and set generated flag to true
*/
protected generateGearPool(): void;
}

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,54 @@
import { ItemHelper } from "../helpers/ItemHelper";
import { Item } from "../models/eft/common/tables/IItem";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { IBotConfig } from "../models/spt/config/IBotConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
export declare class BotModLimits {
scope: ItemCount;
scopeMax: number;
scopeBaseTypes: string[];
flashlightLaser: ItemCount;
flashlightLaserMax: number;
flashlgihtLaserBaseTypes: string[];
}
export declare class ItemCount {
count: number;
}
export declare class BotWeaponModLimitService {
protected logger: ILogger;
protected configServer: ConfigServer;
protected itemHelper: ItemHelper;
protected botConfig: IBotConfig;
constructor(logger: ILogger, configServer: ConfigServer, itemHelper: ItemHelper);
/**
* Initalise mod limits to be used when generating a weapon
* @param botRole "assault", "bossTagilla" or "pmc"
* @returns BotModLimits object
*/
getWeaponModLimits(botRole: string): BotModLimits;
/**
* Check if weapon mod item is on limited list + has surpassed the limit set for it
* Exception: Always allow ncstar backup mount
* Exception: Always allow scopes with a scope for a parent
* Exception: Always disallow mounts that hold only scopes once scope limit reached
* Exception: Always disallow mounts that hold only flashlights once flashlight limit reached
* @param botRole role the bot has e.g. assault
* @param modTemplate mods template data
* @param modLimits limits set for weapon being generated for this bot
* @param modsParent The parent of the mod to be checked
* @returns true if over item limit
*/
weaponModHasReachedLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits, modsParent: ITemplateItem, weapon: Item[]): boolean;
/**
* Check if the specific item type on the weapon has reached the set limit
* @param modTpl log mod tpl if over type limit
* @param currentCount current number of this item on gun
* @param maxLimit mod limit allowed
* @param botRole role of bot we're checking weapon of
* @returns true if limit reached
*/
protected weaponModLimitReached(modTpl: string, currentCount: {
count: number;
}, maxLimit: number, botRole: string): boolean;
}

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
@ -91,9 +93,9 @@ export declare class FenceService {
*/
getOfferCount(): number;
/**
* Create a trader assort for fence
* Create trader assorts for fence and store in fenceService cache
*/
generateFenceAssortCache(): void;
generateFenceAssorts(): void;
/**
* Create skeleton to hold assort items
* @returns ITraderAssort object

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";
@ -12,6 +13,7 @@ import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer";
import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil";
import { LocalisationService } from "./LocalisationService";
export declare class InsuranceService {
protected logger: ILogger;
protected databaseServer: DatabaseServer;
@ -21,14 +23,16 @@ export declare class InsuranceService {
protected saveServer: SaveServer;
protected traderHelper: TraderHelper;
protected dialogueHelper: DialogueHelper;
protected handbookHelper: HandbookHelper;
protected localisationService: LocalisationService;
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, localisationService: LocalisationService, configServer: ConfigServer);
insuranceExists(sessionId: string): boolean;
insuranceTraderArrayExists(sessionId: string, traderId: string): boolean;
getInsurance(sessionId: string): Record<string, Item[]>;
getInsuranceItems(sessionId: string, traderId: string): any[];
getInsuranceItems(sessionId: string, traderId: string): Item[];
resetInsurance(sessionId: string): void;
resetInsuranceTraderArray(sessionId: string, traderId: string): void;
addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: any): void;

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