diff --git a/types/callbacks/BotCallbacks.d.ts b/types/callbacks/BotCallbacks.d.ts index 827015e..036e545 100644 --- a/types/callbacks/BotCallbacks.d.ts +++ b/types/callbacks/BotCallbacks.d.ts @@ -10,6 +10,7 @@ export declare class BotCallbacks { constructor(botController: BotController, httpResponse: HttpResponseUtil); /** * Handle singleplayer/settings/bot/limit + * Is called by client to define each bot roles wave limit * @returns string */ getBotLimit(url: string, info: IEmptyRequestData, sessionID: string): string; diff --git a/types/callbacks/GameCallbacks.d.ts b/types/callbacks/GameCallbacks.d.ts index aa80036..46f79f9 100644 --- a/types/callbacks/GameCallbacks.d.ts +++ b/types/callbacks/GameCallbacks.d.ts @@ -1,4 +1,5 @@ import { GameController } from "../controllers/GameController"; +import { OnLoad } from "../di/OnLoad"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { ICurrentGroupResponse } from "../models/eft/game/ICurrentGroupResponse"; @@ -15,12 +16,14 @@ import { INullResponseData } from "../models/eft/httpResponse/INullResponseData" import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { Watermark } from "../utils/Watermark"; -declare class GameCallbacks { +declare class GameCallbacks implements OnLoad { protected httpResponse: HttpResponseUtil; protected watermark: Watermark; protected saveServer: SaveServer; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, saveServer: SaveServer, gameController: GameController); + onLoad(): Promise; + getRoute(): string; /** * Handle client/game/version/validate * @returns INullResponseData diff --git a/types/callbacks/InventoryCallbacks.d.ts b/types/callbacks/InventoryCallbacks.d.ts index a182127..5d4b51d 100644 --- a/types/callbacks/InventoryCallbacks.d.ts +++ b/types/callbacks/InventoryCallbacks.d.ts @@ -21,8 +21,11 @@ import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRout export declare class InventoryCallbacks { protected inventoryController: InventoryController; constructor(inventoryController: InventoryController); + /** Handle Move event */ moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + /** Handle Remove event */ removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; + /** Handle Split event */ splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/types/callbacks/LauncherCallbacks.d.ts b/types/callbacks/LauncherCallbacks.d.ts index c022325..20d99de 100644 --- a/types/callbacks/LauncherCallbacks.d.ts +++ b/types/callbacks/LauncherCallbacks.d.ts @@ -24,5 +24,7 @@ declare class LauncherCallbacks { ping(url: string, info: IEmptyRequestData, sessionID: string): string; removeProfile(url: string, info: IRemoveProfileData, sessionID: string): string; getCompatibleTarkovVersion(): string; + getLoadedServerMods(): string; + getServerModsProfileUsed(url: string, info: IEmptyRequestData, sessionId: string): string; } export { LauncherCallbacks }; diff --git a/types/callbacks/NotifierCallbacks.d.ts b/types/callbacks/NotifierCallbacks.d.ts index ca94ff4..eb1ead9 100644 --- a/types/callbacks/NotifierCallbacks.d.ts +++ b/types/callbacks/NotifierCallbacks.d.ts @@ -6,11 +6,13 @@ import { INotifierChannel } from "../models/eft/notifier/INotifier"; import { ISelectProfileRequestData } from "../models/eft/notifier/ISelectProfileRequestData"; import { ISelectProfileResponse } from "../models/eft/notifier/ISelectProfileResponse"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class NotifierCallbacks { protected httpServerHelper: HttpServerHelper; protected httpResponse: HttpResponseUtil; + protected jsonUtil: JsonUtil; protected notifierController: NotifierController; - constructor(httpServerHelper: HttpServerHelper, httpResponse: HttpResponseUtil, notifierController: NotifierController); + constructor(httpServerHelper: HttpServerHelper, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, notifierController: NotifierController); /** * If we don't have anything to send, it's ok to not send anything back * because notification requests can be long-polling. In fact, we SHOULD wait diff --git a/types/callbacks/PresetBuildCallbacks.d.ts b/types/callbacks/PresetBuildCallbacks.d.ts index 541714d..e5973a9 100644 --- a/types/callbacks/PresetBuildCallbacks.d.ts +++ b/types/callbacks/PresetBuildCallbacks.d.ts @@ -4,16 +4,23 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IPresetBuildActionRequestData } from "../models/eft/presetBuild/IPresetBuildActionRequestData"; -import { WeaponBuild } from "../models/eft/profile/IAkiProfile"; +import { IRemoveBuildRequestData } from "../models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "../models/eft/profile/IAkiProfile"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class PresetBuildCallbacks { protected httpResponse: HttpResponseUtil; protected presetBuildController: PresetBuildController; constructor(httpResponse: HttpResponseUtil, presetBuildController: PresetBuildController); /** Handle client/handbook/builds/my/list */ - getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - /** Handle SaveBuild event */ - saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveBuild event*/ - removeBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; + getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** Handle SaveWeaponBuild event */ + saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; + /** Handle removeBuild event*/ + removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; + /** Handle RemoveWeaponBuild event*/ + removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; + /** Handle SaveEquipmentBuild event */ + saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; + /** Handle RemoveEquipmentBuild event*/ + removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/types/callbacks/RagfairCallbacks.d.ts b/types/callbacks/RagfairCallbacks.d.ts index 1f37b07..5ba1176 100644 --- a/types/callbacks/RagfairCallbacks.d.ts +++ b/types/callbacks/RagfairCallbacks.d.ts @@ -14,9 +14,11 @@ import { IGetOffersResult } from "../models/eft/ragfair/IGetOffersResult"; import { IRemoveOfferRequestData } from "../models/eft/ragfair/IRemoveOfferRequestData"; import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; import { ISendRagfairReportRequestData } from "../models/eft/ragfair/ISendRagfairReportRequestData"; +import { IStorePlayerOfferTaxAmountRequestData } from "../models/eft/ragfair/IStorePlayerOfferTaxAmountRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; +import { RagfairTaxService } from "../services/RagfairTaxService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; /** @@ -27,9 +29,10 @@ export declare class RagfairCallbacks implements OnLoad, OnUpdate { protected jsonUtil: JsonUtil; protected ragfairServer: RagfairServer; protected ragfairController: RagfairController; + protected ragfairTaxService: RagfairTaxService; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer); + constructor(httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, ragfairTaxService: RagfairTaxService, configServer: ConfigServer); onLoad(): Promise; getRoute(): string; onUpdate(timeSinceLastRun: number): Promise; @@ -53,4 +56,5 @@ export declare class RagfairCallbacks implements OnLoad, OnUpdate { getFleaPrices(url: string, request: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; /** Handle client/reports/ragfair/send */ sendReport(url: string, info: ISendRagfairReportRequestData, sessionID: string): INullResponseData; + storePlayerOfferTaxAmount(url: string, request: IStorePlayerOfferTaxAmountRequestData, sessionId: string): INullResponseData; } diff --git a/types/callbacks/TradeCallbacks.d.ts b/types/callbacks/TradeCallbacks.d.ts index 8351e50..1c0cb32 100644 --- a/types/callbacks/TradeCallbacks.d.ts +++ b/types/callbacks/TradeCallbacks.d.ts @@ -3,6 +3,7 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBaseTradeRequestData } from "../models/eft/trade/IProcessBaseTradeRequestData"; import { IProcessRagfairTradeRequestData } from "../models/eft/trade/IProcessRagfairTradeRequestData"; +import { ISellScavItemsToFenceRequestData } from "../models/eft/trade/ISellScavItemsToFenceRequestData"; export declare class TradeCallbacks { protected tradeController: TradeController; constructor(tradeController: TradeController); @@ -12,4 +13,6 @@ export declare class TradeCallbacks { processTrade(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairBuyOffer event */ processRagfairTrade(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** Handle SellAllFromSavage event */ + sellAllFromSavage(pmcData: IPmcData, body: ISellScavItemsToFenceRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/types/controllers/BotController.d.ts b/types/controllers/BotController.d.ts index bbdf519..c343f95 100644 --- a/types/controllers/BotController.d.ts +++ b/types/controllers/BotController.d.ts @@ -8,6 +8,7 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { IBotCore } from "../models/eft/common/tables/IBotCore"; import { Difficulty } from "../models/eft/common/tables/IBotType"; import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { IPmcConfig } from "../models/spt/config/IPmcConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -29,6 +30,7 @@ export declare class BotController { protected applicationContext: ApplicationContext; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; + protected pmcConfig: IPmcConfig; static readonly pmcTypeLabel = "PMC"; constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** @@ -70,5 +72,5 @@ export declare class BotController { * @returns cap number */ getBotCap(): number; - getPmcBotTypes(): Record>>; + getAiBotBrainTypes(): any; } diff --git a/types/controllers/DialogueController.d.ts b/types/controllers/DialogueController.d.ts index 310b9e7..d673159 100644 --- a/types/controllers/DialogueController.d.ts +++ b/types/controllers/DialogueController.d.ts @@ -1,4 +1,5 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; import { IGetFriendListDataResponse } from "../models/eft/dialog/IGetFriendListDataResponse"; import { IGetMailDialogViewRequestData } from "../models/eft/dialog/IGetMailDialogViewRequestData"; @@ -6,21 +7,28 @@ import { IGetMailDialogViewResponseData } from "../models/eft/dialog/IGetMailDia import { ISendMessageRequest } from "../models/eft/dialog/ISendMessageRequest"; import { Dialogue, DialogueInfo, IAkiProfile, IUserDialogInfo, Message } from "../models/eft/profile/IAkiProfile"; import { MessageType } from "../models/enums/MessageType"; +import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; import { GiftService } from "../services/GiftService"; import { MailSendService } from "../services/MailSendService"; import { HashUtil } from "../utils/HashUtil"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class DialogueController { protected logger: ILogger; protected saveServer: SaveServer; protected timeUtil: TimeUtil; protected dialogueHelper: DialogueHelper; + protected profileHelper: ProfileHelper; + protected randomUtil: RandomUtil; protected mailSendService: MailSendService; protected giftService: GiftService; protected hashUtil: HashUtil; - constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, dialogueHelper: DialogueHelper, mailSendService: MailSendService, giftService: GiftService, hashUtil: HashUtil); + protected configServer: ConfigServer; + protected coreConfig: ICoreConfig; + constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, randomUtil: RandomUtil, mailSendService: MailSendService, giftService: GiftService, hashUtil: HashUtil, configServer: ConfigServer); /** Handle onUpdate spt event */ update(): void; /** @@ -69,7 +77,7 @@ export declare class DialogueController { */ protected getDialogByIdFromProfile(profile: IAkiProfile, request: IGetMailDialogViewRequestData): Dialogue; /** - * Get the users involved in a mail between two entities + * Get the users involved in a mail between two entities * @param fullProfile Player profile * @param dialogUsers The participants of the mail * @returns IUserDialogInfo array @@ -88,21 +96,37 @@ export declare class DialogueController { * @returns true if uncollected rewards found */ protected messagesHaveUncollectedRewards(messages: Message[]): boolean; - /** Handle client/mail/dialog/remove */ - removeDialogue(dialogueID: string, sessionID: string): void; - setDialoguePin(dialogueID: string, shouldPin: boolean, sessionID: string): void; - /** Handle client/mail/dialog/read */ - setRead(dialogueIDs: string[], sessionID: string): void; + /** + * Handle client/mail/dialog/remove + * Remove an entire dialog with an entity (trader/user) + * @param dialogueId id of the dialog to remove + * @param sessionId Player id + */ + removeDialogue(dialogueId: string, sessionId: string): void; + /** Handle client/mail/dialog/pin && Handle client/mail/dialog/unpin */ + setDialoguePin(dialogueId: string, shouldPin: boolean, sessionId: string): void; + /** + * Handle client/mail/dialog/read + * Set a dialog to be read (no number alert/attachment alert) + * @param dialogueIds Dialog ids to set as read + * @param sessionId Player profile id + */ + setRead(dialogueIds: string[], sessionId: string): void; /** * Handle client/mail/dialog/getAllAttachments * Get all uncollected items attached to mail in a particular dialog - * @param dialogueID Dialog to get mail attachments from - * @param sessionID Session id + * @param dialogueId Dialog to get mail attachments from + * @param sessionId Session id * @returns */ - getAllAttachments(dialogueID: string, sessionID: string): IGetAllAttachmentsResponse; + getAllAttachments(dialogueId: string, sessionId: string): IGetAllAttachmentsResponse; /** client/mail/msg/send */ sendMessage(sessionId: string, request: ISendMessageRequest): string; + /** + * Send responses back to player when they communicate with SPT friend on friends list + * @param sessionId Session Id + * @param request send message request + */ protected handleChatWithSPTFriend(sessionId: string, request: ISendMessageRequest): void; protected getSptFriendData(friendId?: string): IUserDialogInfo; /** diff --git a/types/controllers/GameController.d.ts b/types/controllers/GameController.d.ts index 6d0ce18..b6903b7 100644 --- a/types/controllers/GameController.d.ts +++ b/types/controllers/GameController.d.ts @@ -14,26 +14,32 @@ import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { ILootConfig } from "../models/spt/config/ILootConfig"; +import { IPmcConfig } from "../models/spt/config/IPmcConfig"; +import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { CustomLocationWaveService } from "../services/CustomLocationWaveService"; import { GiftService } from "../services/GiftService"; +import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { LocalisationService } from "../services/LocalisationService"; import { OpenZoneService } from "../services/OpenZoneService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { SeasonalEventService } from "../services/SeasonalEventService"; -import { EncodingUtil } from "../utils/EncodingUtil"; +import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class GameController { protected logger: ILogger; protected databaseServer: DatabaseServer; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; + protected hashUtil: HashUtil; protected preAkiModLoader: PreAkiModLoader; protected httpServerHelper: HttpServerHelper; - protected encodingUtil: EncodingUtil; + protected randomUtil: RandomUtil; protected hideoutHelper: HideoutHelper; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; @@ -41,6 +47,7 @@ export declare class GameController { protected customLocationWaveService: CustomLocationWaveService; protected openZoneService: OpenZoneService; protected seasonalEventService: SeasonalEventService; + protected itemBaseClassService: ItemBaseClassService; protected giftService: GiftService; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; @@ -48,11 +55,24 @@ export declare class GameController { protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, encodingUtil: EncodingUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, giftService: GiftService, applicationContext: ApplicationContext, configServer: ConfigServer); + protected ragfairConfig: IRagfairConfig; + protected pmcConfig: IPmcConfig; + protected lootConfig: ILootConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, applicationContext: ApplicationContext, configServer: ConfigServer); + load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + protected addCustomLooseLootPositions(): void; + protected adjustLooseLootSpawnProbabilities(): void; + protected setHideoutAreasAndCraftsTo40Secs(): void; + /** + * 3.7.0 moved AIDs to be numeric, old profiles need to be migrated + * We store the old AID value in new field `sessionId` + * @param fullProfile Profile to update + */ + protected fixIncorrectAidValue(fullProfile: IAkiProfile): void; /** Apply custom limits on bot types as defined in configs/location.json/botTypeLimits */ protected adjustMapBotLimits(): void; /** @@ -84,6 +104,7 @@ export declare class GameController { * @param pmcProfile Player profile */ protected warnOnActiveBotReloadSkill(pmcProfile: IPmcData): void; + protected flagAllItemsInDbAsSellableOnFlea(): void; /** * When player logs in, iterate over all active effects and reduce timer * TODO - add body part HP regen @@ -118,9 +139,14 @@ export declare class GameController { protected validateQuestAssortUnlocksExist(): void; /** * Add the logged in players name to PMC name pool - * @param pmcProfile + * @param pmcProfile Profile of player to get name from */ protected addPlayerToPMCNames(pmcProfile: IPmcData): void; + /** + * Check for a dialog with the key 'undefined', and remove it + * @param fullProfile Profile to check for dialog in + */ + protected checkForAndRemoveUndefinedDialogs(fullProfile: IAkiProfile): void; /** * Blank out the "test" mail message from prapor */ diff --git a/types/controllers/HealthController.d.ts b/types/controllers/HealthController.d.ts index 1938297..2d7ff09 100644 --- a/types/controllers/HealthController.d.ts +++ b/types/controllers/HealthController.d.ts @@ -29,34 +29,35 @@ export declare class HealthController { * stores in-raid player health * @param pmcData Player profile * @param info Request data - * @param sessionID + * @param sessionID Player id * @param addEffects Should effects found be added or removed from profile + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, info: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** * When healing in menu - * @param pmcData - * @param body - * @param sessionID - * @returns + * @param pmcData Player profile + * @param request Healing request + * @param sessionID Player id + * @returns IItemEventRouterResponse */ - offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + offraidHeal(pmcData: IPmcData, request: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle Eat event * Consume food/water outside of a raid * @param pmcData Player profile - * @param body request Object + * @param request Eat request * @param sessionID Session id * @returns IItemEventRouterResponse */ - offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + offraidEat(pmcData: IPmcData, request: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle RestoreHealth event * Occurs on post-raid healing page * @param pmcData player profile * @param healthTreatmentRequest Request data from client * @param sessionID Session id - * @returns + * @returns IItemEventRouterResponse */ healthTreatment(pmcData: IPmcData, healthTreatmentRequest: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -66,12 +67,4 @@ export declare class HealthController { * @param sessionID */ applyWorkoutChanges(pmcData: IPmcData, info: IWorkoutData, sessionId: string): void; - /** - * Iterate over treatment request diff and find effects to remove from player limbs - * @param sessionId - * @param profile Profile to update - * @param treatmentRequest client request - * @param output response to send to client - */ - protected removeEffectsAfterPostRaidHeal(sessionId: string, profile: IPmcData, treatmentRequest: IHealthTreatmentRequestData, output: IItemEventRouterResponse): void; } diff --git a/types/controllers/HideoutController.d.ts b/types/controllers/HideoutController.d.ts index c8e82f0..a90a16d 100644 --- a/types/controllers/HideoutController.d.ts +++ b/types/controllers/HideoutController.d.ts @@ -8,6 +8,7 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { HideoutArea, Product } from "../models/eft/common/tables/IBotBase"; import { HideoutUpgradeCompleteRequestData } from "../models/eft/hideout/HideoutUpgradeCompleteRequestData"; import { IHandleQTEEventRequestData } from "../models/eft/hideout/IHandleQTEEventRequestData"; +import { IHideoutArea, Stage } from "../models/eft/hideout/IHideoutArea"; import { IHideoutContinuousProductionStartRequestData } from "../models/eft/hideout/IHideoutContinuousProductionStartRequestData"; import { IHideoutImproveAreaRequestData } from "../models/eft/hideout/IHideoutImproveAreaRequestData"; import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; @@ -21,6 +22,7 @@ import { IHideoutUpgradeRequestData } from "../models/eft/hideout/IHideoutUpgrad import { IQteData } from "../models/eft/hideout/IQteData"; import { IRecordShootingRangePoints } from "../models/eft/hideout/IRecordShootingRangePoints"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { HideoutAreas } from "../models/enums/HideoutAreas"; import { IHideoutConfig } from "../models/spt/config/IHideoutConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -76,6 +78,37 @@ export declare class HideoutController { * @returns IItemEventRouterResponse */ upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Upgrade wall status to visible in profile if medstation/water collector are both level 1 + * @param pmcData Player profile + */ + protected checkAndUpgradeWall(pmcData: IPmcData): void; + /** + * + * @param pmcData Profile to edit + * @param output Object to send back to client + * @param sessionID Session/player id + * @param profileParentHideoutArea Current hideout area for profile + * @param dbHideoutArea Hideout area being upgraded + * @param hideoutStage Stage hideout area is being upgraded to + */ + protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileParentHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; + /** + * Add an inventory item to profile from a hideout area stage data + * @param pmcData Profile to update + * @param dbHideoutData Hideout area from db being upgraded + * @param hideoutStage Stage area upgraded to + */ + protected addUpdateInventoryItemToProfile(pmcData: IPmcData, dbHideoutData: IHideoutArea, hideoutStage: Stage): void; + /** + * + * @param output Objet to send to client + * @param sessionID Session/player id + * @param areaType Hideout area that had stash added + * @param hideoutDbData Hideout area that caused addition of stash + * @param hideoutStage Hideout area upgraded to this + */ + protected addContainerUpgradeToClientOutput(output: IItemEventRouterResponse, sessionID: string, areaType: HideoutAreas, hideoutDbData: IHideoutArea, hideoutStage: Stage): void; /** * Handle HideoutPutItemsInAreaSlots * Create item in hideout slot item array, remove item from player inventory @@ -174,7 +207,7 @@ export declare class HideoutController { */ protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; /** - * Handles giving rewards stored in player profile to player after clicking 'get rewards' + * Handles generating case rewards and sending to player inventory * @param sessionID Session id * @param pmcData Player profile * @param request Get rewards from scavcase craft request diff --git a/types/controllers/InraidController.d.ts b/types/controllers/InraidController.d.ts index f224662..6e86c63 100644 --- a/types/controllers/InraidController.d.ts +++ b/types/controllers/InraidController.d.ts @@ -104,10 +104,8 @@ export declare class InraidController { /** * Mark inventory items as FiR if player survived raid, otherwise remove FiR from them * @param offraidData Save Progress Request - * @param pmcData player profile - * @param isPlayerScav Was the player a pScav */ - protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData): void; /** * Update profile after player completes scav raid * @param scavData Scav profile diff --git a/types/controllers/InsuranceController.d.ts b/types/controllers/InsuranceController.d.ts index ae85e96..061d0c9 100644 --- a/types/controllers/InsuranceController.d.ts +++ b/types/controllers/InsuranceController.d.ts @@ -1,12 +1,15 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData"; import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { Insurance } from "../models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -14,6 +17,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; +import { MailSendService } from "../services/MailSendService"; import { PaymentService } from "../services/PaymentService"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -27,26 +31,134 @@ export declare class InsuranceController { protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; protected dialogueHelper: DialogueHelper; + protected traderHelper: TraderHelper; protected paymentService: PaymentService; protected insuranceService: InsuranceService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, paymentService: PaymentService, insuranceService: InsuranceService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer); /** - * Process insurance items prior to being given to player in mail - */ + * Process insurance items of all profiles prior to being given back to the player through the mail service. + * + * @returns void + */ processReturn(): void; /** - * Should the passed in item be removed from player inventory - * @param insuredItem Insurued item to roll to lose - * @param traderId Trader the item was insured by - * @param itemsBeingDeleted All items to remove from player - * @returns True if item should be removed + * Process insurance items of a single profile prior to being given back to the player through the mail service. + * + * @returns void + */ + processReturnByProfile(sessionID: string): void; + /** + * Get all insured items that are ready to be processed in a specific profile. + * + * @param sessionID Session ID of the profile to check. + * @param time The time to check ready status against. Current time by default. + * @returns All insured items that are ready to be processed. */ - protected itemShouldBeLost(insuredItem: Item, traderId: string, itemsBeingDeleted: string[]): boolean; + protected filterInsuredItems(sessionID: string, time?: number): Insurance[]; + /** + * This method orchestrates the processing of insured items in a profile. + * + * @param insuranceDetails The insured items to process. + * @param sessionID The session ID that should receive the processed items. + * @returns void + */ + protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Build an array of items to delete from the insured items. + * + * This method orchestrates several steps: + * - Filters items based on their presence in the database and their raid moddability. + * - Sorts base and independent child items to consider for deletion. + * - Groups child items by their parent for later evaluation. + * - Evaluates grouped child items to decide which should be deleted, based on their value and a random roll. + * + * @param insured - The insured items to build a removal array from. + * @returns An array of IDs representing items that should be deleted. + */ + protected findItemsToDelete(insured: Insurance): string[]; + /** + * Filters an item based on its existence in the database, raid moddability, and slot requirements. + * + * @param item The item to be filtered. + * @param parentItemDbDetails The database details of the parent item, or null if the item has no parent. + * @param itemDbDetails A tuple where the first element is a boolean indicating if the item exists in the database, + * and the second element is the item details if it does. + * @returns true if the item exists in the database and neither of the following conditions are met: + * - The item has the RaidModdable property set to false. + * - The item is attached to a required slot in its parent item. + * Otherwise, returns false. + */ + protected filterByRaidModdability(item: Item, parentItemDbDetails: ITemplateItem | null, itemDbDetails: [boolean, ITemplateItem]): boolean; + /** + * Determines if an item is either a base item or a child item that is not equipped to its parent. + * + * @param item The item to check. + * @returns true if the item is a base or an independent child item, otherwise false. + */ + protected isBaseOrIndependentChild(item: Item): boolean; + /** + * Makes a roll to determine if a given item should be deleted. If the roll is successful, the item's ID is added + * to the `toDelete` array. + * + * @param item The item for which the roll is made. + * @param traderId The ID of the trader to consider in the rollForItemDelete method. + * @param toDelete The array accumulating the IDs of items to be deleted. + * @returns true if the item is marked for deletion, otherwise false. + */ + protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: string[]): boolean; + /** + * Groups child items by their parent IDs in a Map data structure. + * + * @param item The child item to be grouped by its parent. + * @param childrenGroupedByParent The Map that holds arrays of children items grouped by their parent IDs. + * @returns void + */ + protected groupChildrenByParent(item: Item, childrenGroupedByParent: Map): void; + /** + * Sorts the array of children items in descending order by their maximum price. For each child, a roll is made to + * determine if it should be deleted. The method then deletes the most valuable children based on the number of + * successful rolls made. + * + * @param children The array of children items to sort and filter. + * @param traderId The ID of the trader to consider in the rollForItemDelete method. + * @param toDelete The array that accumulates the IDs of the items to be deleted. + * @returns void + */ + protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: string[]): void; + /** + * Remove items from the insured items that should not be returned to the player. + * + * @param insured The insured items to process. + * @param toDelete The items that should be deleted. + * @returns void + */ + protected removeItemsFromInsurance(insured: Insurance, toDelete: string[]): void; + /** + * Handle sending the insurance message to the user that potentially contains the valid insurance items. + * + * @param sessionID The session ID that should receive the insurance message. + * @param insurance The context of insurance to use. + * @param noItems Whether or not there are any items to return to the player. + * @returns void + */ + protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void; + /** + * Determines whether a valid insured item should be removed from the player's inventory based on a random roll and + * trader-specific return chance. + * + * @param insuredItem The insured item being evaluated for removal. + * @param traderId The ID of the trader who insured the item. + * @param itemsBeingDeleted List of items that are already slated for removal. + * @returns true if the insured item should be removed from inventory, false otherwise. + */ + protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: string[]): boolean; /** * Handle Insure event * Add insurance to an item + * * @param pmcData Player profile * @param body Insurance request * @param sessionID Session id @@ -56,9 +168,10 @@ export declare class InsuranceController { /** * Handle client/insurance/items/list/cost * Calculate insurance cost - * @param info request object + * + * @param request request object * @param sessionID session id * @returns IGetInsuranceCostResponseData object to send to client */ - cost(info: IGetInsuranceCostRequestData, sessionID: string): IGetInsuranceCostResponseData; + cost(request: IGetInsuranceCostRequestData, sessionID: string): IGetInsuranceCostResponseData; } diff --git a/types/controllers/InventoryController.d.ts b/types/controllers/InventoryController.d.ts index 3fe5b39..5e7d19a 100644 --- a/types/controllers/InventoryController.d.ts +++ b/types/controllers/InventoryController.d.ts @@ -76,30 +76,46 @@ export declare class InventoryController { */ removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; /** + * Handle Remove event * Implements functionality "Discard" from Main menu (Stash etc.) * Removes item from PMC Profile */ discardItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse; /** - * Split Item - * spliting 1 item-stack into 2 separate items ... - */ - splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; + * Split Item + * spliting 1 stack into 2 + * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) + * @param request Split request + * @param sessionID Session/player id + * @returns IItemEventRouterResponse + */ + splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse; /** - * Merge Item - * merges 2 items into one, deletes item from `body.item` and adding number of stacks into `body.with` + * Fully merge 2 inventory stacks together into one stack (merging where both stacks remain is called 'transfer') + * Deletes item from `body.item` and adding number of stacks into `body.with` + * @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile) + * @param body Merge request + * @param sessionID Player id + * @returns IItemEventRouterResponse */ mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse; /** - * Transfer item - * Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload" - */ + * TODO: Adds no data to output to send to client, is this by design? + * TODO: should make use of getOwnerInventoryItems(), stack being transferred may not always be on pmc + * Transfer items from one stack into another while keeping original stack + * Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload" + * @param pmcData Player profile + * @param body Transfer request + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse; /** * Swap Item * its used for "reload" if you have weapon in hands and magazine is somewhere else in rig or backpack in equipment + * Also used to swap items using quick selection on character screen */ - swapItem(pmcData: IPmcData, body: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse; + swapItem(pmcData: IPmcData, request: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse; /** * Handles folding of Weapons */ diff --git a/types/controllers/LauncherController.d.ts b/types/controllers/LauncherController.d.ts index e8d2311..66d1f7b 100644 --- a/types/controllers/LauncherController.d.ts +++ b/types/controllers/LauncherController.d.ts @@ -1,10 +1,13 @@ import { HttpServerHelper } from "../helpers/HttpServerHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { PreAkiModLoader } from "../loaders/PreAkiModLoader"; import { IChangeRequestData } from "../models/eft/launcher/IChangeRequestData"; import { ILoginRequestData } from "../models/eft/launcher/ILoginRequestData"; import { IRegisterData } from "../models/eft/launcher/IRegisterData"; -import { Info } from "../models/eft/profile/IAkiProfile"; +import { Info, ModDetails } from "../models/eft/profile/IAkiProfile"; import { IConnectResponse } from "../models/eft/profile/IConnectResponse"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; +import { IPackageJsonData } from "../models/spt/mod/IPackageJsonData"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; @@ -14,11 +17,13 @@ export declare class LauncherController { protected hashUtil: HashUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; + protected profileHelper: ProfileHelper; protected databaseServer: DatabaseServer; protected localisationService: LocalisationService; + protected preAkiModLoader: PreAkiModLoader; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer); connect(): IConnectResponse; /** * Get descriptive text for each of the profile edtions a player can choose @@ -33,4 +38,15 @@ export declare class LauncherController { changePassword(info: IChangeRequestData): string; wipe(info: IRegisterData): string; getCompatibleTarkovVersion(): string; + /** + * Get the mods the server has currently loaded + * @returns Dictionary of mod name and mod details + */ + getLoadedServerMods(): Record; + /** + * Get the mods a profile has ever loaded into game with + * @param sessionId Player id + * @returns Array of mod details + */ + getServerModsProfileUsed(sessionId: string): ModDetails[]; } diff --git a/types/controllers/LocationController.d.ts b/types/controllers/LocationController.d.ts index 156936e..94f5fce 100644 --- a/types/controllers/LocationController.d.ts +++ b/types/controllers/LocationController.d.ts @@ -4,8 +4,10 @@ import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; import { IAirdropLootResult } from "../models/eft/location/IAirdropLootResult"; +import { IGetLocationRequestData } from "../models/eft/location/IGetLocationRequestData"; import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; +import { ILocationConfig } from "../models/spt/config/ILocationConfig"; import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -13,10 +15,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class LocationController { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected randomUtil: RandomUtil; protected weightedRandomHelper: WeightedRandomHelper; protected logger: ILogger; protected locationGenerator: LocationGenerator; @@ -26,16 +30,18 @@ export declare class LocationController { protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + protected locationConfig: ILocationConfig; + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data - * @param location Map to generate loot for + * @param sessionId Player id + * @param request Map request to generate * @returns ILocationBase */ - get(location: string): ILocationBase; + get(sessionId: string, request: IGetLocationRequestData): ILocationBase; /** - * Generate a maps base location without loot + * Generate a maps base location with loot * @param name Map name * @returns ILocationBase */ diff --git a/types/controllers/MatchController.d.ts b/types/controllers/MatchController.d.ts index 1535ee6..ce9bc7f 100644 --- a/types/controllers/MatchController.d.ts +++ b/types/controllers/MatchController.d.ts @@ -9,9 +9,9 @@ import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestDa import { IGetRaidConfigurationRequestData } from "../models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; +import { IPmcConfig } from "../models/spt/config/IPmcConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; @@ -32,7 +32,7 @@ export declare class MatchController { protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; - protected botConfig: IBotConfig; + protected pmcConfig: IPmcConfig; constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; /** Handle raid/profile/list */ diff --git a/types/controllers/PresetBuildController.d.ts b/types/controllers/PresetBuildController.d.ts index 563c5cc..d7bd3f3 100644 --- a/types/controllers/PresetBuildController.d.ts +++ b/types/controllers/PresetBuildController.d.ts @@ -2,20 +2,35 @@ import { ItemHelper } from "../helpers/ItemHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IPresetBuildActionRequestData } from "../models/eft/presetBuild/IPresetBuildActionRequestData"; -import { WeaponBuild } from "../models/eft/profile/IAkiProfile"; +import { IRemoveBuildRequestData } from "../models/eft/presetBuild/IRemoveBuildRequestData"; +import { IUserBuilds } from "../models/eft/profile/IAkiProfile"; +import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { HashUtil } from "../utils/HashUtil"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class PresetBuildController { + protected logger: ILogger; protected hashUtil: HashUtil; protected eventOutputHolder: EventOutputHolder; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected saveServer: SaveServer; - constructor(hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, saveServer: SaveServer); + constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer); /** Handle client/handbook/builds/my/list */ - getUserBuilds(sessionID: string): WeaponBuild[]; - /** Handle SaveBuild event */ - saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - /** Handle RemoveBuild event*/ - removeBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; + getUserBuilds(sessionID: string): IUserBuilds; + /** Handle SaveWeaponBuild event */ + saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionId: string): IItemEventRouterResponse; + /** Handle SaveEquipmentBuild event */ + saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; + protected saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string, buildType: string): IItemEventRouterResponse; + /** Handle RemoveWeaponBuild event*/ + removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse; + /** Handle RemoveWeaponBuild event*/ + removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; + /** Handle RemoveEquipmentBuild event*/ + removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; + protected removePlayerBuild(pmcData: IPmcData, id: string, sessionID: string): IItemEventRouterResponse; } diff --git a/types/controllers/QuestController.d.ts b/types/controllers/QuestController.d.ts index 27a5a1a..bd8a70f 100644 --- a/types/controllers/QuestController.d.ts +++ b/types/controllers/QuestController.d.ts @@ -5,6 +5,7 @@ import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { IQuestStatus } from "../models/eft/common/tables/IBotBase"; import { Item } from "../models/eft/common/tables/IItem"; import { AvailableForConditions, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; @@ -23,10 +24,12 @@ import { MailSendService } from "../services/MailSendService"; import { PlayerService } from "../services/PlayerService"; import { SeasonalEventService } from "../services/SeasonalEventService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class QuestController { protected logger: ILogger; protected timeUtil: TimeUtil; + protected jsonUtil: JsonUtil; protected httpResponseUtil: HttpResponseUtil; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; @@ -43,7 +46,7 @@ export declare class QuestController { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, httpResponseUtil: HttpResponseUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, mailSendService: MailSendService, profileHelper: ProfileHelper, traderHelper: TraderHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, seasonalEventService: SeasonalEventService, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, jsonUtil: JsonUtil, httpResponseUtil: HttpResponseUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, mailSendService: MailSendService, profileHelper: ProfileHelper, traderHelper: TraderHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, seasonalEventService: SeasonalEventService, localisationService: LocalisationService, configServer: ConfigServer); /** * Handle client/quest/list * Get all quests visible to player @@ -58,7 +61,7 @@ export declare class QuestController { * @param playerLevel level of player to test against quest * @returns true if quest can be seen/accepted by player of defined level */ - protected playerLevelFulfillsQuestRequrement(quest: IQuest, playerLevel: number): boolean; + protected playerLevelFulfillsQuestRequirement(quest: IQuest, playerLevel: number): boolean; /** * Should a quest be shown to the player in trader quest screen * @param questId Quest to check @@ -110,6 +113,13 @@ export declare class QuestController { * @returns ItemEvent client response */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Return quests that have different statuses + * @param preQuestStatusus Quests before + * @param postQuestStatuses Quests after + * @returns QuestStatusChange array + */ + protected getQuestsWithDifferentStatuses(preQuestStatusus: IQuestStatus[], postQuestStatuses: IQuestStatus[]): IQuestStatus[]; /** * Send a popup to player on successful completion of a quest * @param sessionID session id @@ -132,13 +142,14 @@ export declare class QuestController { */ protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[]; /** - * Fail the quests provided + * Fail the provided quests * Update quest in profile, otherwise add fresh quest object with failed status * @param sessionID session id * @param pmcData player profile * @param questsToFail quests to fail + * @param output Client output */ - protected failQuests(sessionID: string, pmcData: IPmcData, questsToFail: IQuest[]): void; + protected failQuests(sessionID: string, pmcData: IPmcData, questsToFail: IQuest[], output: IItemEventRouterResponse): void; /** * Handle QuestHandover event * @param pmcData Player profile diff --git a/types/controllers/RagfairController.d.ts b/types/controllers/RagfairController.d.ts index 4dcb4b2..bda37cd 100644 --- a/types/controllers/RagfairController.d.ts +++ b/types/controllers/RagfairController.d.ts @@ -8,7 +8,6 @@ import { RagfairHelper } from "../helpers/RagfairHelper"; import { RagfairOfferHelper } from "../helpers/RagfairOfferHelper"; import { RagfairSellHelper } from "../helpers/RagfairSellHelper"; import { RagfairSortHelper } from "../helpers/RagfairSortHelper"; -import { RagfairTaxHelper } from "../helpers/RagfairTaxHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; @@ -22,6 +21,7 @@ import { IGetMarketPriceRequestData } from "../models/eft/ragfair/IGetMarketPric import { IGetOffersResult } from "../models/eft/ragfair/IGetOffersResult"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; +import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -34,6 +34,7 @@ import { PaymentService } from "../services/PaymentService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairPriceService } from "../services/RagfairPriceService"; import { RagfairRequiredItemsService } from "../services/RagfairRequiredItemsService"; +import { RagfairTaxService } from "../services/RagfairTaxService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; /** @@ -50,7 +51,7 @@ export declare class RagfairController { protected itemHelper: ItemHelper; protected saveServer: SaveServer; protected ragfairSellHelper: RagfairSellHelper; - protected ragfairTaxHelper: RagfairTaxHelper; + protected ragfairTaxService: RagfairTaxService; protected ragfairSortHelper: RagfairSortHelper; protected ragfairOfferHelper: RagfairOfferHelper; protected profileHelper: ProfileHelper; @@ -66,12 +67,12 @@ export declare class RagfairController { protected localisationService: LocalisationService; 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); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxService: RagfairTaxService, 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, searchRequest: ISearchRequestData): IGetOffersResult; /** * Get offers for the client based on type of search being performed * @param searchRequest Client search request data - * @param itemsToAdd + * @param itemsToAdd comes from ragfairHelper.filterCategories() * @param traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers @@ -125,6 +126,18 @@ export declare class RagfairController { * @returns IItemEventRouterResponse */ addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Charge player a listing fee for using flea, pulls charge from data previously sent by client + * @param sessionID Player id + * @param rootItem Base item being listed (used when client tax cost not found and must be done on server) + * @param pmcData Player profile + * @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server) + * @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server) + * @param offerRequest Add offer request object from client + * @param output IItemEventRouterResponse + * @returns True if charging tax to player failed + */ + protected chargePlayerTaxFee(sessionID: string, rootItem: Item, pmcData: IPmcData, requirementsPriceInRub: number, itemStackCount: number, offerRequest: IAddOfferRequestData, output: IItemEventRouterResponse): boolean; /** * Is the item to be listed on the flea valid * @param offerRequest Client offer request @@ -149,6 +162,20 @@ export declare class RagfairController { createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; getStaticPrices(): Record; + /** + * User requested removal of the offer, actually reduces the time to 71 seconds, + * allowing for the possibility of extending the auction before it's end time + * @param offerId offer to 'remove' + * @param sessionID Players id + * @returns IItemEventRouterResponse + */ removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Create a basic trader request object with price and currency type + * @param currency What currency: RUB, EURO, USD + * @param value Amount of currency + * @returns IProcessBuyTradeRequestData + */ + protected createBuyTradeRequestObject(currency: string, value: number): IProcessBuyTradeRequestData; } diff --git a/types/controllers/TradeController.d.ts b/types/controllers/TradeController.d.ts index c201791..38e9c01 100644 --- a/types/controllers/TradeController.d.ts +++ b/types/controllers/TradeController.d.ts @@ -1,11 +1,15 @@ import { ItemHelper } from "../helpers/ItemHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { TradeHelper } from "../helpers/TradeHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { Upd } from "../models/eft/common/tables/IItem"; +import { Item, Upd } from "../models/eft/common/tables/IItem"; +import { ITraderBase } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBaseTradeRequestData } from "../models/eft/trade/IProcessBaseTradeRequestData"; import { IProcessRagfairTradeRequestData } from "../models/eft/trade/IProcessRagfairTradeRequestData"; +import { ISellScavItemsToFenceRequestData } from "../models/eft/trade/ISellScavItemsToFenceRequestData"; +import { Traders } from "../models/enums/Traders"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -13,24 +17,50 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { LocalisationService } from "../services/LocalisationService"; +import { RagfairPriceService } from "../services/RagfairPriceService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; declare class TradeController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; + protected traderHelper: TraderHelper; + protected jsonUtil: JsonUtil; protected ragfairServer: RagfairServer; protected httpResponse: HttpResponseUtil; protected localisationService: LocalisationService; + protected ragfairPriceService: RagfairPriceService; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, configServer: ConfigServer); /** Handle TradingConfirm event */ confirmTrading(pmcData: IPmcData, request: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse; /** Handle RagFairBuyOffer event */ confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; + /** Handle SellAllFromSavage event */ + sellScavItemsToFence(pmcData: IPmcData, body: ISellScavItemsToFenceRequestData, sessionId: string): IItemEventRouterResponse; + /** + * Sell all sellable items to a trader from inventory + * WILL DELETE ITEMS FROM INVENTORY + CHILDREN OF ITEMS SOLD + * @param sessionId Session id + * @param profileWithItemsToSell Profile with items to be sold to trader + * @param profileThatGetsMoney Profile that gets the money after selling items + * @param trader Trader to sell items to + * @returns IItemEventRouterResponse + */ + protected sellInventoryToTrader(sessionId: string, profileWithItemsToSell: IPmcData, profileThatGetsMoney: IPmcData, trader: Traders): IItemEventRouterResponse; + /** + * Looks up an items children and gets total handbook price for them + * @param parentItemId parent item that has children we want to sum price of + * @param items All items (parent + children) + * @param handbookPrices Prices of items from handbook + * @param traderDetails Trader being sold to to perform buy category check against + * @returns Rouble price + */ + protected getPriceOfItemAndChildren(parentItemId: string, items: Item[], handbookPrices: Record, traderDetails: ITraderBase): number; protected confirmTradingInternal(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; } export { TradeController }; diff --git a/types/generators/BotEquipmentModGenerator.d.ts b/types/generators/BotEquipmentModGenerator.d.ts index ad44c17..f7abb84 100644 --- a/types/generators/BotEquipmentModGenerator.d.ts +++ b/types/generators/BotEquipmentModGenerator.d.ts @@ -14,7 +14,6 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; -import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; @@ -29,7 +28,6 @@ export declare class BotEquipmentModGenerator { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemBaseClassService: ItemBaseClassService; protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponModLimitService: BotWeaponModLimitService; @@ -40,7 +38,7 @@ export declare class BotEquipmentModGenerator { 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, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + 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 @@ -83,10 +81,11 @@ export declare class BotEquipmentModGenerator { */ protected modSlotCanHoldScope(modSlot: string, modsParentId: string): boolean; /** - * Set all scope mod chances to 100% - * @param modSpawnChances Chances objet to update + * Set mod spawn chances to defined amount + * @param modSpawnChances Chance dictionary to update */ - protected setScopeSpawnChancesToFull(modSpawnChances: ModsChances): void; + protected adjustSlotSpawnChances(modSpawnChances: ModsChances, modSlotsToAdjust: string[], newChancePercent: number): void; + protected modSlotCanHoldMuzzleDevices(modSlot: string, modsParentId: string): boolean; protected sortModKeys(unsortedKeys: string[]): string[]; /** * Get a Slot property for an item (chamber/cartridge/slot) @@ -193,10 +192,12 @@ export declare class BotEquipmentModGenerator { protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; /** * Filter out non-whitelisted weapon scopes + * Controlled by bot.json weaponSightWhitelist + * e.g. filter out rifle scopes from SMGs * @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 + * @param botWeaponSightWhitelist Whitelist of scope types by weapon base type + * @returns Array of scope tpls that have been filtered to just ones allowed for that weapon type */ protected filterSightsByWeaponType(weapon: Item, scopes: string[], botWeaponSightWhitelist: Record): string[]; } diff --git a/types/generators/BotGenerator.d.ts b/types/generators/BotGenerator.d.ts index 5236a12..270e4af 100644 --- a/types/generators/BotGenerator.d.ts +++ b/types/generators/BotGenerator.d.ts @@ -3,13 +3,15 @@ import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; -import { Health, IBotType } from "../models/eft/common/tables/IBotType"; +import { Appearance, Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { IPmcConfig } from "../models/spt/config/IPmcConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { SeasonalEventService } from "../services/SeasonalEventService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -32,9 +34,11 @@ export declare class BotGenerator { protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; protected seasonalEventService: SeasonalEventService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botLevelGenerator: BotLevelGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, seasonalEventService: SeasonalEventService, configServer: ConfigServer); + protected pmcConfig: IPmcConfig; + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botLevelGenerator: BotLevelGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, seasonalEventService: SeasonalEventService, localisationService: LocalisationService, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -64,6 +68,13 @@ export declare class BotGenerator { * @returns IBotBase object */ protected generateBot(sessionId: string, bot: IBotBase, botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails): IBotBase; + /** + * Choose various appearance settings for a bot using weights + * @param bot Bot to adjust + * @param appearance Appearance settings to choose from + * @param botGenerationDetails Generation details + */ + protected setBotAppearance(bot: IBotBase, appearance: Appearance, botGenerationDetails: BotGenerationDetails): void; /** * Create a bot nickname * @param botJsonTemplate x.json from database @@ -71,7 +82,7 @@ export declare class BotGenerator { * @param botRole role of bot e.g. assault * @returns Nickname for bot */ - protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string): string; + protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string, sessionId: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client diff --git a/types/generators/BotInventoryGenerator.d.ts b/types/generators/BotInventoryGenerator.d.ts index 63935bb..e660390 100644 --- a/types/generators/BotInventoryGenerator.d.ts +++ b/types/generators/BotInventoryGenerator.d.ts @@ -1,5 +1,6 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; import { BotHelper } from "../helpers/BotHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; import { Chances, Generation, IBotType, Inventory, Mods } from "../models/eft/common/tables/IBotType"; @@ -25,12 +26,13 @@ export declare class BotInventoryGenerator { protected botGeneratorHelper: BotGeneratorHelper; protected botHelper: BotHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected itemHelper: ItemHelper; 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, botHelper: BotHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, botEquipmentModGenerator: BotEquipmentModGenerator, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, botHelper: BotHelper, weightedRandomHelper: WeightedRandomHelper, itemHelper: ItemHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, botEquipmentModGenerator: BotEquipmentModGenerator, configServer: ConfigServer); /** * Add equipment/weapons/loot to bot * @param sessionId Session id @@ -103,10 +105,10 @@ export declare class BotInventoryGenerator { * @param equipmentChances Chances bot can have equipment equipped * @param botRole assault/pmcBot/bossTagilla etc * @param isPmc Is the bot being generated as a pmc - * @param itemGenerationLimitsMinMax + * @param itemGenerationWeights */ protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; - }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void; + }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationWeights: Generation, botLevel: number): void; } diff --git a/types/generators/BotLootGenerator.d.ts b/types/generators/BotLootGenerator.d.ts index 6f2f6ec..d0e8758 100644 --- a/types/generators/BotLootGenerator.d.ts +++ b/types/generators/BotLootGenerator.d.ts @@ -2,11 +2,14 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; import { IBotType, Inventory, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentSlots } from "../models/enums/EquipmentSlots"; import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { IPmcConfig } from "../models/spt/config/IPmcConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -25,11 +28,13 @@ export declare class BotLootGenerator { protected botGeneratorHelper: BotGeneratorHelper; protected botWeaponGenerator: BotWeaponGenerator; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected botLootCacheService: BotLootCacheService; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); + protected pmcConfig: IPmcConfig; + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); /** * Add loot to bots containers * @param sessionId Session id @@ -40,17 +45,36 @@ export declare class BotLootGenerator { * @param botLevel Level of bot */ generateLoot(sessionId: string, botJsonTemplate: IBotType, isPmc: boolean, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Get an array of the containers a bot has on them (pockets/backpack/vest) + * @param botInventory Bot to check + * @returns Array of available slots + */ + protected getAvailableContainersBotCanStoreItemsIn(botInventory: PmcInventory): EquipmentSlots[]; + /** + * Force healing items onto bot to ensure they can heal in-raid + * @param botInventory Inventory to add items to + * @param botRole Role of bot (sptBear/sptUsec) + */ + protected addForcedMedicalItemsToPmcSecure(botInventory: PmcInventory, botRole: string): void; + /** + * Get a biased random number + * @param min Smallest size + * @param max Biggest size + * @param nValue Value to bias choice + * @returns Chosen number + */ protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached - * @param pool pool of items to pick from - * @param equipmentSlots What equality slot will the loot items be added to + * @param pool Pool of items to pick from + * @param equipmentSlots What equipment slot will the loot items be added to * @param totalItemCount Max count of items to add - * @param inventoryToAddItemsTo bot inventory loot will be added to - * @param botRole role of the bot loot is being generated for (assault/pmcbot) - * @param useLimits should item limit counts be used as defined in config/bot.json - * @param totalValueLimitRub total value of loot allowed in roubles - * @param isPmc is the bot being generated for a pmc + * @param inventoryToAddItemsTo Bot inventory loot will be added to + * @param botRole Role of the bot loot is being generated for (assault/pmcbot) + * @param useLimits Should item limit counts be used as defined in config/bot.json + * @param totalValueLimitRub Total value of loot allowed in roubles + * @param isPmc Is bot being generated for a pmc */ protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, useLimits?: boolean, totalValueLimitRub?: number, isPmc?: boolean): void; /** @@ -64,38 +88,23 @@ export declare class BotLootGenerator { */ protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; /** - * @deprecated replaced by getRandomItemFromPoolByRole() * Get a random item from the pool parameter using the biasedRandomNumber system - * @param pool pool of items to pick an item from - * @param isPmc is the bot being created a pmc - * @returns ITemplateItem object - */ - protected getRandomItemFromPool(pool: ITemplateItem[], isPmc: boolean): ITemplateItem; - /** - * Get a random item from the pool parameter using the biasedRandomNumber system - * @param pool pool of items to pick an item from - * @param isPmc is the bot being created a pmc + * @param pool Pool of items to pick an item from + * @param isPmc Is the bot being created a pmc * @returns ITemplateItem object */ protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; /** - * @deprecated Replaced by getBotLootNValueByRole() * Get the loot nvalue from botconfig - * @param isPmc if true the pmc nvalue is returned - * @returns nvalue as number - */ - protected getBotLootNValue(isPmc: boolean): number; - /** - * Get the loot nvalue from botconfig - * @param botRole role of bot e.g. assault/sptBear + * @param botRole Role of bot e.g. assault/bosstagilla/sptBear * @returns nvalue as number */ protected getBotLootNValueByRole(botRole: string): number; /** - * Update item limit array to contain items that have a limit + * Hydrate item limit array to contain items that have a limit for a specific bot type * All values are set to 0 - * @param isPmc is the bot a pmc - * @param botRole role the bot has + * @param isPmc Is the bot a pmc + * @param botRole Role the bot has * @param limitCount */ protected initItemLimitArray(isPmc: boolean, botRole: string, limitCount: Record): void; @@ -104,8 +113,8 @@ export declare class BotLootGenerator { * @param itemTemplate Item we check to see if its reached spawn limit * @param botRole Bot type * @param isPmc Is bot we're working with a pmc - * @param limitCount spawn limits for items on bot - * @param itemSpawnLimits the limits this bot is allowed to have + * @param limitCount Spawn limits for items on bot + * @param itemSpawnLimits The limits this bot is allowed to have * @returns true if item has reached spawn limit */ protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, isPmc: boolean, limitCount: Record, itemSpawnLimits: Record): boolean; diff --git a/types/generators/BotWeaponGenerator.d.ts b/types/generators/BotWeaponGenerator.d.ts index 6c28462..ff3fb4c 100644 --- a/types/generators/BotWeaponGenerator.d.ts +++ b/types/generators/BotWeaponGenerator.d.ts @@ -2,18 +2,20 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { MinMax } from "../models/common/MinMax"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Inventory, ModsChances } from "../models/eft/common/tables/IBotType"; +import { GenerationData, Inventory, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { GenerateWeaponResult } from "../models/spt/bots/GenerateWeaponResult"; import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { IPmcConfig } from "../models/spt/config/IPmcConfig"; +import { IRepairConfig } from "../models/spt/config/IRepairConfig"; 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 { RepairService } from "../services/RepairService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -33,10 +35,13 @@ export declare class BotWeaponGenerator { protected botWeaponModLimitService: BotWeaponModLimitService; protected botEquipmentModGenerator: BotEquipmentModGenerator; protected localisationService: LocalisationService; + protected repairService: RepairService; 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, botWeaponModLimitService: BotWeaponModLimitService, botEquipmentModGenerator: BotEquipmentModGenerator, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); + protected pmcConfig: IPmcConfig; + protected repairConfig: IRepairConfig; + 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, repairService: RepairService, inventoryMagGenComponents: IInventoryMagGen[]); /** * Pick a random weapon based on weightings and generate a functional weapon * @param equipmentSlot Primary/secondary/holster @@ -63,7 +68,7 @@ export declare class BotWeaponGenerator { * @param weaponParentId ParentId of the weapon being generated * @param modChances Dictionary of item types and % chance weapon will have that mod * @param botRole e.g. assault/exusec - * @param isPmc + * @param isPmc Is weapon being generated for a pmc * @returns GenerateWeaponResult object */ generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult; @@ -104,11 +109,11 @@ export declare class BotWeaponGenerator { * Generates extra magazines or bullets (if magazine is internal) and adds them to TacticalVest and Pockets. * Additionally, adds extra bullets to SecuredContainer * @param generatedWeaponResult object with properties for generated weapon (weapon mods pool / weapon template / ammo tpl) - * @param magCounts Magazine count to add to inventory + * @param magWeights Magazine weights for count to add to inventory * @param inventory Inventory to add magazines to * @param botRole The bot type we're getting generating extra mags for */ - addExtraMagazinesToInventory(generatedWeaponResult: GenerateWeaponResult, magCounts: MinMax, inventory: PmcInventory, botRole: string): void; + addExtraMagazinesToInventory(generatedWeaponResult: GenerateWeaponResult, magWeights: GenerationData, inventory: PmcInventory, botRole: string): void; /** * Add Grendaes for UBGL to bots vest and secure container * @param weaponMods Weapon array with mods diff --git a/types/generators/LocationGenerator.d.ts b/types/generators/LocationGenerator.d.ts index d5bf61c..46a514b 100644 --- a/types/generators/LocationGenerator.d.ts +++ b/types/generators/LocationGenerator.d.ts @@ -2,12 +2,15 @@ import { ContainerHelper } from "../helpers/ContainerHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { IContainerMinMax, IStaticContainer } from "../models/eft/common/ILocation"; +import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "../models/eft/common/ILooseLoot"; import { Item } from "../models/eft/common/tables/IItem"; -import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticLootDetails } from "../models/eft/common/tables/ILootBase"; +import { IStaticAmmoDetails, IStaticContainerData, IStaticForcedProps, IStaticLootDetails } from "../models/eft/common/tables/ILootBase"; 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 { LocalisationService } from "../services/LocalisationService"; import { SeasonalEventService } from "../services/SeasonalEventService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -19,8 +22,15 @@ export interface IContainerItem { width: number; height: number; } +export interface IContainerGroupCount { + /** Containers this group has + probabilty to spawn */ + containerIdsWithProbability: Record; + /** How many containers the map should spawn with this group id */ + chosenCount: number; +} export declare class LocationGenerator { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected jsonUtil: JsonUtil; protected objectId: ObjectId; protected randomUtil: RandomUtil; @@ -33,7 +43,39 @@ export declare class LocationGenerator { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - 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); + constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Create an array of container objects with randomised loot + * @param locationBase Map base to generate containers for + * @param staticAmmoDist Static ammo distribution - database.loot.staticAmmo + * @returns Array of container objects + */ + generateStaticContainers(locationBase: ILocationBase, staticAmmoDist: Record): SpawnpointTemplate[]; + /** + * Get containers with a non-100% chance to spawn OR are NOT on the container type randomistion blacklist + * @param staticContainers + * @returns IStaticContainerData array + */ + protected getRandomisableContainersOnMap(staticContainers: IStaticContainerData[]): IStaticContainerData[]; + /** + * Get containers with 100% spawn rate or have a type on the randomistion ignore list + * @param staticContainersOnMap + * @returns IStaticContainerData array + */ + protected getGuaranteedContainers(staticContainersOnMap: IStaticContainerData[]): IStaticContainerData[]; + /** + * Choose a number of containers based on their probabilty value to fulfil the desired count in containerData.chosenCount + * @param groupId Name of the group the containers are being collected for + * @param containerData Containers and probability values for a groupId + * @returns List of chosen container Ids + */ + protected getContainersByProbabilty(groupId: string, containerData: IContainerGroupCount): string[]; + /** + * Get a mapping of each groupid and the containers in that group + count of containers to spawn on map + * @param containersGroups Container group values + * @returns dictionary keyed by groupId + */ + protected getGroupIdToContainerMappings(staticContainerGroupData: IStaticContainer | Record, staticContainersOnMap: IStaticContainerData[]): Record; /** * Choose loot to put into a static container based on weighting * Handle forced items + seasonal item removal when not in season @@ -44,7 +86,7 @@ export declare class LocationGenerator { * @param locationName Name of the map to generate static loot for * @returns IStaticContainerProps */ - generateContainerLoot(staticContainer: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; + protected addLootToContainer(staticContainer: IStaticContainerData, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerData; /** * Get a 2d grid of a containers item slots * @param containerTpl Tpl id of the container @@ -88,9 +130,10 @@ export declare class LocationGenerator { * Create array of item (with child items) and return * @param chosenComposedKey Key we want to look up items for * @param spawnPoint Dynamic spawn point item we want will be placed in + * @param staticAmmoDist ammo distributions * @returns IContainerItem */ - protected createDynamicLootItem(chosenComposedKey: string, spawnPoint: Spawnpoint): IContainerItem; + protected createDynamicLootItem(chosenComposedKey: string, spawnPoint: Spawnpoint, staticAmmoDist: Record): IContainerItem; /** * Replace the _id value for base item + all children items parentid value * @param itemWithChildren Item with mods to update diff --git a/types/generators/PMCLootGenerator.d.ts b/types/generators/PMCLootGenerator.d.ts index 7a258df..abb5615 100644 --- a/types/generators/PMCLootGenerator.d.ts +++ b/types/generators/PMCLootGenerator.d.ts @@ -1,6 +1,6 @@ import { ItemHelper } from "../helpers/ItemHelper"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { IPmcConfig } from "../models/spt/config/IPmcConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; @@ -18,7 +18,7 @@ export declare class PMCLootGenerator { protected pocketLootPool: string[]; protected vestLootPool: string[]; protected backpackLootPool: string[]; - protected botConfig: IBotConfig; + protected pmcConfig: IPmcConfig; constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService); /** * Create an array of loot items a PMC can have in their pockets @@ -31,12 +31,12 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/height that lets it fit into a 1x2/2x1 slot - * 1x1 / 1x2 / 2x1 + * Check if item has a width/height that lets it fit into a 2x2 slot + * 1x1 / 1x2 / 2x1 / 2x2 * @param item Item to check size of * @returns true if it fits */ - protected itemFitsInto1By2Slot(item: ITemplateItem): boolean; + protected itemFitsInto2By2Slot(item: ITemplateItem): boolean; /** * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls diff --git a/types/generators/RagfairOfferGenerator.d.ts b/types/generators/RagfairOfferGenerator.d.ts index a627191..58e0b68 100644 --- a/types/generators/RagfairOfferGenerator.d.ts +++ b/types/generators/RagfairOfferGenerator.d.ts @@ -55,11 +55,10 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer - * @param sellInOnePiece Set StackObjectsCount to 1 + * @param sellInOnePiece Flags sellInOnePiece to be true * @returns IRagfairOffer */ - createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Create an offer object ready to send to ragfairOfferService.addOffer() * @param userID Owner of the offer @@ -67,17 +66,16 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer * @param sellInOnePiece Set StackObjectsCount to 1 * @returns IRagfairOffer */ - protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Calculate the offer price that's listed on the flea listing * @param offerRequirements barter requirements for offer * @returns rouble cost of offer */ - protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; + protected convertOfferRequirementsIntoRoubles(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -137,7 +135,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -151,7 +149,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails db details of first item * @returns */ - protected getItemCondition(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -184,7 +182,7 @@ export declare class RagfairOfferGenerator { * @param offerItems Items for sale in offer * @returns Barter scheme */ - protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + protected createBarterBarterScheme(offerItems: Item[]): IBarterScheme[]; /** * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values @@ -196,7 +194,9 @@ export declare class RagfairOfferGenerator { /** * Create a random currency-based barter scheme for an array of items * @param offerItems Items on offer + * @param isPackOffer Is the barter scheme being created for a pack offer + * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; + protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/types/generators/ScavCaseRewardGenerator.d.ts b/types/generators/ScavCaseRewardGenerator.d.ts index 4ba1888..d40b4d2 100644 --- a/types/generators/ScavCaseRewardGenerator.d.ts +++ b/types/generators/ScavCaseRewardGenerator.d.ts @@ -25,6 +25,8 @@ export declare class ScavCaseRewardGenerator { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; + protected dbItemsCache: ITemplateItem[]; + protected dbAmmoItemsCache: ITemplateItem[]; constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build @@ -33,12 +35,12 @@ export declare class ScavCaseRewardGenerator { */ generate(recipeId: string): Product[]; /** - * Get all db items that are not blacklisted in scavcase config - * @returns filtered array of db items + * Get all db items that are not blacklisted in scavcase config or global blacklist + * Store in class field */ - protected getDbItems(): ITemplateItem[]; + protected cacheDbItems(): void; /** - * Pick a number of items to be rewards, the count is defined by the values in + * Pick a number of items to be rewards, the count is defined by the values in `itemFilters` param * @param items item pool to pick rewards from * @param itemFilters how the rewards should be filtered down (by item count) * @returns diff --git a/types/generators/WeatherGenerator.d.ts b/types/generators/WeatherGenerator.d.ts index 2e2403c..6471bb1 100644 --- a/types/generators/WeatherGenerator.d.ts +++ b/types/generators/WeatherGenerator.d.ts @@ -52,6 +52,7 @@ export declare class WeatherGenerator { */ protected setCurrentDateTime(weather: IWeather): void; protected getWeightedWindDirection(): WindDirection; + protected getWeightedClouds(): number; protected getWeightedWindSpeed(): number; protected getWeightedFog(): number; protected getWeightedRain(): number; diff --git a/types/generators/weapongen/InventoryMagGen.d.ts b/types/generators/weapongen/InventoryMagGen.d.ts index 30bf79f..f827a61 100644 --- a/types/generators/weapongen/InventoryMagGen.d.ts +++ b/types/generators/weapongen/InventoryMagGen.d.ts @@ -1,5 +1,5 @@ -import { MinMax } from "../../models/common/MinMax"; import { Inventory } from "../../models/eft/common/tables/IBotBase"; +import { GenerationData } from "../../models/eft/common/tables/IBotType"; import { ITemplateItem } from "../../models/eft/common/tables/ITemplateItem"; export declare class InventoryMagGen { private magCounts; @@ -7,8 +7,8 @@ export declare class InventoryMagGen { private weaponTemplate; private ammoTemplate; private pmcInventory; - constructor(magCounts: MinMax, magazineTemplate: ITemplateItem, weaponTemplate: ITemplateItem, ammoTemplate: ITemplateItem, pmcInventory: Inventory); - getMagCount(): MinMax; + constructor(magCounts: GenerationData, magazineTemplate: ITemplateItem, weaponTemplate: ITemplateItem, ammoTemplate: ITemplateItem, pmcInventory: Inventory); + getMagCount(): GenerationData; getMagazineTemplate(): ITemplateItem; getWeaponTemplate(): ITemplateItem; getAmmoTemplate(): ITemplateItem; diff --git a/types/helpers/BotDifficultyHelper.d.ts b/types/helpers/BotDifficultyHelper.d.ts index df2c269..bb20955 100644 --- a/types/helpers/BotDifficultyHelper.d.ts +++ b/types/helpers/BotDifficultyHelper.d.ts @@ -1,5 +1,5 @@ import { Difficulty } from "../models/eft/common/tables/IBotType"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { IPmcConfig } from "../models/spt/config/IPmcConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -15,7 +15,7 @@ export declare class BotDifficultyHelper { protected localisationService: LocalisationService; protected botHelper: BotHelper; protected configServer: ConfigServer; - protected botConfig: IBotConfig; + protected pmcConfig: IPmcConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, localisationService: LocalisationService, botHelper: BotHelper, configServer: ConfigServer); getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; /** diff --git a/types/helpers/BotGeneratorHelper.d.ts b/types/helpers/BotGeneratorHelper.d.ts index 4eec4dd..81750bd 100644 --- a/types/helpers/BotGeneratorHelper.d.ts +++ b/types/helpers/BotGeneratorHelper.d.ts @@ -2,7 +2,8 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper"; import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; -import { EquipmentFilters, IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, IBotConfig, IRandomisedResourceValues } from "../models/spt/config/IBotConfig"; +import { IPmcConfig } from "../models/spt/config/IPmcConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -20,6 +21,7 @@ export declare class BotGeneratorHelper { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; + protected pmcConfig: IPmcConfig; constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item @@ -31,6 +33,13 @@ export declare class BotGeneratorHelper { generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; + /** + * Randomize the HpResource for bots e.g (245/400 resources) + * @param maxResource Max resource value of medical items + * @param randomizationValues Value provided from config + * @returns Randomized value from maxHpResource + */ + protected getRandomizedResourceValue(maxResource: number, randomizationValues: IRandomisedResourceValues): number; /** * Get the chance for the weapon attachment or helmet equipment to be set as activated * @param botRole role of bot with weapon/helmet diff --git a/types/helpers/BotHelper.d.ts b/types/helpers/BotHelper.d.ts index 3b49501..3bbdcb1 100644 --- a/types/helpers/BotHelper.d.ts +++ b/types/helpers/BotHelper.d.ts @@ -1,6 +1,7 @@ import { MinMax } from "../models/common/MinMax"; import { Difficulty, IBotType } from "../models/eft/common/tables/IBotType"; import { EquipmentFilters, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; +import { IPmcConfig } from "../models/spt/config/IPmcConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -15,6 +16,7 @@ export declare class BotHelper { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; + protected pmcConfig: IPmcConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get a template object for the specified botRole from bots.types db @@ -70,7 +72,7 @@ export declare class BotHelper { */ getBotRandomizationDetails(botLevel: number, botEquipConfig: EquipmentFilters): RandomisationDetails; /** - * Choose between sptBear and sptUsec at random based on the % defined in botConfig.pmc.isUsec + * Choose between sptBear and sptUsec at random based on the % defined in pmcConfig.isUsec * @returns pmc role */ getRandomizedPmcRole(): string; diff --git a/types/helpers/BotWeaponGeneratorHelper.d.ts b/types/helpers/BotWeaponGeneratorHelper.d.ts index 8a3784b..bc31d49 100644 --- a/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -1,8 +1,9 @@ -import { MinMax } from "../models/common/MinMax"; import { Inventory } from "../models/eft/common/tables/IBotBase"; +import { GenerationData } from "../models/eft/common/tables/IBotType"; import { Item } from "../models/eft/common/tables/IItem"; import { Grid, ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { EquipmentSlots } from "../models/enums/EquipmentSlots"; +import { ItemAddedResult } from "../models/enums/ItemAddedResult"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocalisationService } from "../services/LocalisationService"; @@ -11,6 +12,7 @@ import { RandomUtil } from "../utils/RandomUtil"; import { ContainerHelper } from "./ContainerHelper"; import { InventoryHelper } from "./InventoryHelper"; import { ItemHelper } from "./ItemHelper"; +import { WeightedRandomHelper } from "./WeightedRandomHelper"; export declare class BotWeaponGeneratorHelper { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -18,22 +20,23 @@ export declare class BotWeaponGeneratorHelper { protected randomUtil: RandomUtil; protected hashUtil: HashUtil; protected inventoryHelper: InventoryHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); /** * Get a randomized number of bullets for a specific magazine - * @param magCounts min and max count of magazines + * @param magCounts Weights of magazines * @param magTemplate magazine to generate bullet count for * @returns bullet count number */ - getRandomizedBulletCount(magCounts: MinMax, magTemplate: ITemplateItem): number; + getRandomizedBulletCount(magCounts: GenerationData, magTemplate: ITemplateItem): number; /** * Get a randomized count of magazines * @param magCounts min and max value returned value can be between * @returns numerical value of magazine count */ - getRandomizedMagazineCount(magCounts: MinMax): number; + getRandomizedMagazineCount(magCounts: GenerationData): number; /** * Is this magazine cylinder related (revolvers and grenade launchers) * @param magazineParentName the name of the magazines parent @@ -47,7 +50,7 @@ export declare class BotWeaponGeneratorHelper { * @param magTemplate template object of magazine * @returns Item array */ - createMagazine(magazineTpl: string, ammoTpl: string, magTemplate: ITemplateItem): Item[]; + createMagazineWithAmmo(magazineTpl: string, ammoTpl: string, magTemplate: ITemplateItem): Item[]; /** * Add a specific number of cartridges to a bots inventory (defaults to vest and pockets) * @param ammoTpl Ammo tpl to add to vest/pockets @@ -72,7 +75,7 @@ export declare class BotWeaponGeneratorHelper { * @param inventory Inventory to add item+children into * @returns a `boolean` indicating item was added */ - addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): boolean; + addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult; /** * is the provided item allowed inside a container * @param slot location item wants to be placed in diff --git a/types/helpers/DialogueHelper.d.ts b/types/helpers/DialogueHelper.d.ts index 6a8adc5..ea3bae7 100644 --- a/types/helpers/DialogueHelper.d.ts +++ b/types/helpers/DialogueHelper.d.ts @@ -41,4 +41,10 @@ export declare class DialogueHelper { * @returns */ getMessageItemContents(messageID: string, sessionID: string, itemId: string): Item[]; + /** + * Get the dialogs dictionary for a profile, create if doesnt exist + * @param sessionId Session/player id + * @returns Dialog dictionary + */ + getDialogsForProfile(sessionId: string): Record; } diff --git a/types/helpers/HealthHelper.d.ts b/types/helpers/HealthHelper.d.ts index 3694a6e..e4cdcd6 100644 --- a/types/helpers/HealthHelper.d.ts +++ b/types/helpers/HealthHelper.d.ts @@ -27,6 +27,7 @@ export declare class HealthHelper { * @param request Heal request * @param sessionID Session id * @param addEffects Should effects be added or removed (default - add) + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, request: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** diff --git a/types/helpers/HideoutHelper.d.ts b/types/helpers/HideoutHelper.d.ts index e9d3746..80ac27c 100644 --- a/types/helpers/HideoutHelper.d.ts +++ b/types/helpers/HideoutHelper.d.ts @@ -51,23 +51,19 @@ export declare class HideoutHelper { * This convenience function initializes new Production Object * with all the constants. */ - initProduction(recipeId: string, productionTime: number): Production; + initProduction(recipeId: string, productionTime: number, needFuelForAllProductionTime: boolean): Production; /** * Is the provided object a Production type * @param productive * @returns */ isProductionType(productive: Productive): productive is Production; - applyPlayerUpgradesBonuses(pmcData: IPmcData, bonus: StageBonus): void; /** - * TODO: - * After looking at the skills there doesnt seem to be a configuration per skill to boost - * the XP gain PER skill. I THINK you should be able to put the variable "SkillProgress" (just like health has it) - * and be able to tune the skill gain PER skill, but I havent tested it and Im not sure! - * @param pmcData - * @param bonus + * Apply bonus to player profile given after completing hideout upgrades + * @param pmcData Profile to add bonus to + * @param bonus Bonus to add to profile */ - protected applySkillXPBoost(pmcData: IPmcData, bonus: StageBonus): void; + applyPlayerUpgradesBonuses(pmcData: IPmcData, bonus: StageBonus): void; /** * Process a players hideout, update areas that use resources + increment production timers * @param sessionID Session id @@ -83,6 +79,7 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }; + protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; /** * Update progress timer for water collector * @param pmcData profile to update @@ -141,9 +138,8 @@ export declare class HideoutHelper { isGeneratorOn: boolean; waterCollectorHasFilter: boolean; }): void; - protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; - protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void; + protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; /** * Adjust water filter objects resourceValue or delete when they reach 0 resource * @param waterFilterArea water filter area to update @@ -153,6 +149,16 @@ export declare class HideoutHelper { * @returns Updated HideoutArea object */ protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; + /** + * Get an adjusted water filter drain rate based on time elapsed since last run, + * handle edge case when craft time has gone on longer than total production time + * @param secondsSinceServerTick Time passed + * @param totalProductionTime Total time collecting water + * @param productionProgress how far water collector has progressed + * @param baseFilterDrainRate Base drain rate + * @returns + */ + protected adjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; /** * Get the water filter drain rate based on hideout bonues player has * @param pmcData Player profile @@ -164,7 +170,7 @@ export declare class HideoutHelper { * @param prodId Id, e.g. Water collector id * @returns seconds to produce item */ - protected getProductionTimeSeconds(prodId: string): number; + protected getTotalProductionTimeSeconds(prodId: string): number; /** * Create a upd object using passed in parameters * @param stackCount @@ -185,9 +191,10 @@ export declare class HideoutHelper { * Get number of ticks that have passed since hideout areas were last processed, reduced when generator is off * @param pmcData Player profile * @param isGeneratorOn Is the generator on for the duration of elapsed time + * @param recipe Hideout production recipe being crafted we need the ticks for * @returns Amount of time elapsed in seconds */ - protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean): number; + protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean, recipe?: IHideoutProduction): number; /** * Get a count of how many BTC can be gathered by the profile * @param pmcData Profile to look up @@ -210,6 +217,12 @@ export declare class HideoutHelper { * @returns Hideout management skill object */ protected getHideoutManagementSkill(pmcData: IPmcData): Common; + /** + * HideoutManagement skill gives a consumption bonus the higher the level + * 0.5% per level per 1-51, (25.5% at max) + * @param pmcData Profile to get hideout consumption level level from + * @returns consumption bonus + */ protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; /** * Adjust craft time based on crafting skill level found in player profile @@ -235,7 +248,7 @@ export declare class HideoutHelper { */ protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData; /** - * Upgrade hideout wall from starting level to interactable level if enough time has passed + * Upgrade hideout wall from starting level to interactable level if necessary stations have been upgraded * @param pmcProfile Profile to upgrade wall in */ unlockHideoutWallInProfile(pmcProfile: IPmcData): void; diff --git a/types/helpers/InRaidHelper.d.ts b/types/helpers/InRaidHelper.d.ts index baaf448..b4c0c1c 100644 --- a/types/helpers/InRaidHelper.d.ts +++ b/types/helpers/InRaidHelper.d.ts @@ -1,7 +1,8 @@ -import { IPmcData } from "../models/eft/common/IPmcData"; -import { Victim } from "../models/eft/common/tables/IBotBase"; +import { IPmcData, IPostRaidPmcData } from "../models/eft/common/IPmcData"; +import { IQuestStatus, TraderInfo, Victim } from "../models/eft/common/tables/IBotBase"; import { Item } from "../models/eft/common/tables/IItem"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; +import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { ILostOnDeathConfig } from "../models/spt/config/ILostOnDeathConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -13,6 +14,7 @@ import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; +import { QuestHelper } from "./QuestHelper"; export declare class InRaidHelper { protected logger: ILogger; protected saveServer: SaveServer; @@ -20,19 +22,21 @@ export declare class InRaidHelper { protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; + protected questHelper: QuestHelper; protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; protected configServer: ConfigServer; protected lostOnDeathConfig: ILostOnDeathConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer); + protected inRaidConfig: IInRaidConfig; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer); /** * Lookup quest item loss from lostOnDeath config * @returns True if items should be removed from inventory */ removeQuestItemsOnDeath(): boolean; /** - * Check an array of items and add an upd object to money items with a stack count of 1 + * Check items array and add an upd object to money with a stack count of 1 * Single stack money items have no upd object and thus no StackObjectsCount, causing issues * @param items Items array to check */ @@ -49,7 +53,7 @@ export declare class InRaidHelper { * @param victim Who was killed by player * @returns a numerical standing gain or loss */ - protected getStandingChangeForKill(victim: Victim): number; + protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property @@ -61,6 +65,14 @@ export declare class InRaidHelper { * @returns Reset profile object */ updateProfileBaseStats(profileData: IPmcData, saveProgressRequest: ISaveProgressRequestData, sessionID: string): IPmcData; + /** + * Look for quests not are now status = fail that were not failed pre-raid and run the failQuest() function + * @param sessionId Player id + * @param pmcData Player profile + * @param preRaidQuests Quests prior to starting raid + * @param postRaidQuests Quest after raid + */ + protected processFailedQuests(sessionId: string, pmcData: IPmcData, preRaidQuests: IQuestStatus[], postRaidQuests: IQuestStatus[]): void; protected resetSkillPointsEarnedDuringRaid(profile: IPmcData): void; /** * Take body part effects from client profile and apply to server profile @@ -68,6 +80,12 @@ export declare class InRaidHelper { * @param profileData player profile on server */ protected transferPostRaidLimbEffectsToProfile(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void; + /** + * Adjust server trader settings if they differ from data sent by client + * @param tradersServerProfile Server + * @param tradersClientProfile Client + */ + protected applyTraderStandingAdjustments(tradersServerProfile: Record, tradersClientProfile: Record): void; /** * Some maps have one-time-use keys (e.g. Labs * Remove the relevant key from an inventory based on the post-raid request data passed in @@ -80,22 +98,13 @@ export declare class InRaidHelper { * @param sessionID Session id */ protected setPlayerInRaidLocationStatusToNone(sessionID: string): void; - /** - * Adds SpawnedInSession property to items found in a raid - * Removes SpawnedInSession for non-scav players if item was taken into raid with SpawnedInSession = true - * @param preRaidProfile profile to update - * @param postRaidProfile profile to update inventory contents of - * @param isPlayerScav Was this a p scav raid - * @returns profile with FiR items properly tagged - */ - addSpawnedInSessionPropertyToItems(preRaidProfile: IPmcData, postRaidProfile: IPmcData, isPlayerScav: boolean): IPmcData; /** * Iterate over inventory items and remove the property that defines an item as Found in Raid * Only removes property if item had FiR when entering raid * @param postRaidProfile profile to update items for * @returns Updated profile with SpawnedInSession removed */ - removeSpawnedInSessionPropertyFromItems(postRaidProfile: IPmcData): IPmcData; + removeSpawnedInSessionPropertyFromItems(postRaidProfile: IPostRaidPmcData): IPostRaidPmcData; /** * Update a players inventory post-raid * Remove equipped items from pre-raid diff --git a/types/helpers/InventoryHelper.d.ts b/types/helpers/InventoryHelper.d.ts index ff96a23..f71b361 100644 --- a/types/helpers/InventoryHelper.d.ts +++ b/types/helpers/InventoryHelper.d.ts @@ -1,9 +1,11 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Inventory } from "../models/eft/common/tables/IBotBase"; import { Item } from "../models/eft/common/tables/IItem"; import { AddItem, IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IAddItemTempObject } from "../models/eft/inventory/IAddItemTempObject"; import { IInventoryMergeRequestData } from "../models/eft/inventory/IInventoryMergeRequestData"; import { IInventoryMoveRequestData } from "../models/eft/inventory/IInventoryMoveRequestData"; +import { IInventoryRemoveRequestData } from "../models/eft/inventory/IInventoryRemoveRequestData"; import { IInventorySplitRequestData } from "../models/eft/inventory/IInventorySplitRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IInventoryConfig, RewardDetails } from "../models/spt/config/IInventoryConfig"; @@ -22,7 +24,9 @@ import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; import { TraderAssortHelper } from "./TraderAssortHelper"; export interface OwnerInventoryItems { + /** Inventory items from source */ from: Item[]; + /** Inventory items at destination */ to: Item[]; sameInventory: boolean; isMail: boolean; @@ -56,9 +60,20 @@ export declare class InventoryHelper { * @param useSortingTable Allow items to go into sorting table when stash has no space * @returns IItemEventRouterResponse */ - addItem(pmcData: IPmcData, request: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: { - (): void; - }, foundInRaid?: boolean, addUpd?: any, useSortingTable?: boolean): IItemEventRouterResponse; + addItem(pmcData: IPmcData, request: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: () => void, foundInRaid?: boolean, addUpd?: any, useSortingTable?: boolean): IItemEventRouterResponse; + /** + * Take the given item, find a free slot in passed in inventory and place it there + * If no space in inventory, place in sorting table + * @param itemToAdd Item to add to inventory + * @param stashFS2D Two dimentional stash map + * @param sortingTableFS2D Two dimentional sorting table stash map + * @param itemLib + * @param pmcData Player profile + * @param useSortingTable Should sorting table be used for overflow items when no inventory space for item + * @param output Client output object + * @returns Client error output if placing item failed + */ + protected placeItemInInventory(itemToAdd: IAddItemTempObject, stashFS2D: number[][], sortingTableFS2D: number[][], itemLib: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Add ammo to ammo boxes * @param itemToAdd Item to check is ammo box @@ -66,8 +81,10 @@ export declare class InventoryHelper { * @param output IItemEventRouterResponse object * @param sessionID Session id * @param pmcData Profile to add ammobox to + * @param output object to send to client + * @param foundInRaid should ammo be FiR */ - protected hydrateAmmoBoxWithAmmo(pmcData: IPmcData, itemToAdd: IAddItemTempObject, parentId: string, sessionID: string, output: IItemEventRouterResponse): void; + protected hydrateAmmoBoxWithAmmo(pmcData: IPmcData, itemToAdd: IAddItemTempObject, parentId: string, sessionID: string, output: IItemEventRouterResponse, foundInRaid: boolean): void; /** * * @param assortItems Items to add to inventory @@ -76,23 +93,31 @@ export declare class InventoryHelper { */ protected splitStackIntoSmallerStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; /** + * Handle Remove event * Remove item from player inventory + insured items array - * @param pmcData Profile to remove item from + * Also deletes child items + * @param profile Profile to remove item from (pmc or scav) * @param itemId Items id to remove * @param sessionID Session id * @param output Existing IItemEventRouterResponse object to append data to, creates new one by default if not supplied * @returns IItemEventRouterResponse */ - removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[]; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[]; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][]; /** + * Return the inventory that needs to be modified (scav/pmc etc) + * Changes made to result apply to character inventory * Based on the item action, determine whose inventories we should be looking at for from and to. + * @param request Item interaction request + * @param sessionId Session id / playerid + * @returns OwnerInventoryItems with inventory of player/scav to adjust */ - getOwnerInventoryItems(body: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData, sessionID: string): OwnerInventoryItems; + getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData, sessionId: string): OwnerInventoryItems; /** * Made a 2d array table with 0 - free slot and 1 - used slot * @param {Object} pmcData @@ -101,19 +126,36 @@ export declare class InventoryHelper { */ protected getStashSlotMap(pmcData: IPmcData, sessionID: string): number[][]; protected getSortingTableSlotMap(pmcData: IPmcData): number[][]; + /** + * Get Player Stash Proper Size + * @param sessionID Playerid + * @returns Array of 2 values, x and y stash size + */ protected getPlayerStashSize(sessionID: string): Record; + /** + * Get the players stash items tpl + * @param sessionID Player id + * @returns Stash tpl + */ protected getStashType(sessionID: string): string; /** - * Internal helper function to transfer an item from one profile to another. - * fromProfileData: Profile of the source. - * toProfileData: Profile of the destination. - * body: Move request - */ + * Internal helper function to transfer an item from one profile to another. + * @param fromItems Inventory of the source (can be non-player) + * @param toItems Inventory of the destination + * @param body Move request + */ moveItemToProfile(fromItems: Item[], toItems: Item[], body: IInventoryMoveRequestData): void; /** - * Internal helper function to move item within the same profile_f. - */ - moveItemInternal(pmcData: IPmcData, inventoryItems: Item[], moveRequest: IInventoryMoveRequestData): void; + * Internal helper function to move item within the same profile_f. + * @param pmcData profile to edit + * @param inventoryItems + * @param moveRequest + * @returns True if move was successful + */ + moveItemInternal(pmcData: IPmcData, inventoryItems: Item[], moveRequest: IInventoryMoveRequestData): { + success: boolean; + errorMessage?: string; + }; /** * Update fast panel bindings when an item is moved into a container that doesnt allow quick slot access * @param pmcData Player profile diff --git a/types/helpers/ItemHelper.d.ts b/types/helpers/ItemHelper.d.ts index 47fe9ab..f58ca4d 100644 --- a/types/helpers/ItemHelper.d.ts +++ b/types/helpers/ItemHelper.d.ts @@ -26,6 +26,7 @@ declare class ItemHelper { protected itemBaseClassService: ItemBaseClassService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected readonly defaultInvalidBaseTypes: string[]; 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 @@ -55,6 +56,13 @@ declare class ItemHelper { * @returns Price in roubles */ getItemPrice(tpl: string): number; + /** + * 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 + * @param tpl Item to look price up of + * @returns Price in roubles + */ + getItemMaxPrice(tpl: string): number; /** * Get the static (handbook) price in roubles for an item by tpl * @param tpl Items tpl id to look up price @@ -67,6 +75,11 @@ declare class ItemHelper { * @returns Price in roubles (undefined if not found) */ getDynamicItemPrice(tpl: string): number; + /** + * Update items upd.StackObjectsCount to be 1 if its upd is missing or StackObjectsCount is undefined + * @param item Item to update + * @returns Fixed item + */ fixItemStackCount(item: Item): Item; /** * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. @@ -125,19 +138,19 @@ declare class ItemHelper { getItemQualityModifier(item: Item): number; /** * Get a quality value based on a repairable items (weapon/armor) current state between current and max durability - * @param itemDetails - * @param repairable repairable object - * @param item - * @returns a number between 0 and 1 + * @param itemDetails Db details for item we want quality value for + * @param repairable Repairable properties + * @param item Item quality value is for + * @returns A number between 0 and 1 */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results - * @param items - * @param itemID + * @param items Array of items (item + possible children) + * @param itemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; + findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. * @param items @@ -164,12 +177,6 @@ declare class ItemHelper { * @returns true if it is a dogtag */ isDogtag(tpl: string): boolean; - /** - * Can the item passed in be sold to a trader because it is raw money - * @param tpl Item template id to check - * @returns true if unsellable - */ - isNotSellable(tpl: string): boolean; /** * Gets the identifier for a child using slotId, locationX and locationY. * @param item @@ -183,19 +190,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its StackMaxSize property - * @param itemToSplit item being split into smaller stacks + * split item stack if it exceeds its items StackMaxSize property + * @param itemToSplit Item to split into smaller stacks * @returns Array of split items */ splitStack(itemToSplit: Item): Item[]; /** - * Find Barter items in the inventory + * Find Barter items from array of items * @param {string} by tpl or id - * @param {Object} pmcData + * @param {Item[]} items Array of items to iterate over * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; /** * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) * @param pmcData Player profile @@ -237,6 +244,14 @@ declare class ItemHelper { * @param ammoBoxDetails Item template from items db */ addCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void; + /** + * Check if item is stored inside of a container + * @param item Item to check is inside of container + * @param desiredContainerSlotId Name of slot to check item is in e.g. SecuredContainer/Backpack + * @param items Inventory with child parent items to check + * @returns True when item is in container + */ + itemIsInsideContainer(item: Item, desiredContainerSlotId: string, items: Item[]): boolean; /** * Add child items (cartridges) to a magazine * @param magazine Magazine to add child items to @@ -254,10 +269,21 @@ declare class ItemHelper { * @param minSizePercent % the magazine must be filled to */ fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + /** + * Choose a random bullet type from the list of possible a magazine has + * @param magTemplate Magazine template from Db + * @returns Tpl of cartridge + */ protected getRandomValidCaliber(magTemplate: ITemplateItem): string; + /** + * Chose a randomly weighted cartridge that fits + * @param caliber Desired caliber + * @param staticAmmoDist Cartridges and thier weights + * @returns Tpl of cartrdige + */ protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; /** - * + * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent diff --git a/types/helpers/PresetHelper.d.ts b/types/helpers/PresetHelper.d.ts index 8f84625..e50cae8 100644 --- a/types/helpers/PresetHelper.d.ts +++ b/types/helpers/PresetHelper.d.ts @@ -13,6 +13,11 @@ export declare class PresetHelper { hasPreset(templateId: string): boolean; getPreset(id: string): IPreset; getPresets(templateId: string): IPreset[]; + /** + * Get the default preset for passed in weapon id + * @param templateId Weapon id to get preset for + * @returns Null if no default preset, otherwise IPreset + */ getDefaultPreset(templateId: string): IPreset; getBaseItemTpl(presetId: string): string; } diff --git a/types/helpers/ProfileHelper.d.ts b/types/helpers/ProfileHelper.d.ts index a2fb099..3c33ae7 100644 --- a/types/helpers/ProfileHelper.d.ts +++ b/types/helpers/ProfileHelper.d.ts @@ -21,11 +21,11 @@ export declare class ProfileHelper { protected profileSnapshotService: ProfileSnapshotService; constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService); /** - * Remove/reset started quest condtions in player profile + * Remove/reset a completed quest condtion from players profile quest data * @param sessionID Session id - * @param conditionIds Condition ids that need to be reset/removed + * @param questConditionId Quest with condition to remove */ - resetProfileQuestCondition(sessionID: string, conditionIds: string[]): void; + removeCompletedQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record): void; /** * Get all profiles from server * @returns Dictionary of profiles diff --git a/types/helpers/QuestConditionHelper.d.ts b/types/helpers/QuestConditionHelper.d.ts index 90ee560..a84bc81 100644 --- a/types/helpers/QuestConditionHelper.d.ts +++ b/types/helpers/QuestConditionHelper.d.ts @@ -3,5 +3,6 @@ export declare class QuestConditionHelper { getQuestConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; getLevelConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; getLoyaltyConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; + getStandingConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; protected filterConditions(q: AvailableForConditions[], questType: string, furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[]; } diff --git a/types/helpers/QuestHelper.d.ts b/types/helpers/QuestHelper.d.ts index dbee0a0..babdf1d 100644 --- a/types/helpers/QuestHelper.d.ts +++ b/types/helpers/QuestHelper.d.ts @@ -1,5 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; -import { Quest } from "../models/eft/common/tables/IBotBase"; +import { IQuestStatus } from "../models/eft/common/tables/IBotBase"; import { Item } from "../models/eft/common/tables/IItem"; import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; @@ -21,6 +21,7 @@ import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { QuestConditionHelper } from "./QuestConditionHelper"; import { RagfairServerHelper } from "./RagfairServerHelper"; import { TraderHelper } from "./TraderHelper"; export declare class QuestHelper { @@ -29,6 +30,7 @@ export declare class QuestHelper { protected timeUtil: TimeUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected questConditionHelper: QuestConditionHelper; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected localeService: LocaleService; @@ -41,7 +43,7 @@ export declare class QuestHelper { protected mailSendService: MailSendService; 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, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -84,7 +86,15 @@ export declare class QuestHelper { * @param profile Player profile * @returns true if loyalty is high enough to fulfill quest requirement */ + traderLoyaltyLevelRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + /** + * Check if trader has sufficient standing to fulfill quest requirement + * @param questProperties Quest props + * @param profile Player profile + * @returns true if standing is high enough to fulfill quest requirement + */ traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + protected compareAvailableForValues(current: number, required: number, compareMethod: string): boolean; /** * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids * @param reward Reward item to fix @@ -104,28 +114,29 @@ export declare class QuestHelper { * @param newState State the new quest should be in when returned * @param acceptedQuest Details of accepted quest from client */ - getQuestReadyForProfile(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): Quest; + getQuestReadyForProfile(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): IQuestStatus; /** * Get quests that can be shown to player after starting a quest * @param startedQuestId Quest started by player * @param sessionID Session id * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; + getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player * @param sessionId Session id - * @returns + * @returns IQuest array */ failedUnlocked(failedQuestId: string, sessionId: string): IQuest[]; /** * Adjust quest money rewards by passed in multiplier * @param quest Quest to multiple money rewards * @param multiplier Value to adjust money rewards by + * @param questStatus Status of quest to apply money boost to rewards of * @returns Updated quest */ - applyMoneyBoost(quest: IQuest, multiplier: number): IQuest; + applyMoneyBoost(quest: IQuest, multiplier: number, questStatus: QuestStatus): IQuest; /** * Sets the item stack to new value, or delete the item if value <= 0 * // TODO maybe merge this function and the one from customization @@ -160,9 +171,10 @@ export declare class QuestHelper { * @param pmcData Player profile * @param failRequest Fail quest request data * @param sessionID Session id + * @param output Client output * @returns Item event router response */ - failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string): IItemEventRouterResponse; + failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; /** * Get List of All Quests from db * NOT CLONED @@ -217,17 +229,18 @@ export declare class QuestHelper { */ protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: Reward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void; /** - * Get players intel center bonus from profile + * Get players money reward bonus from profile * @param pmcData player profile * @returns bonus as a percent */ - protected getIntelCenterRewardBonus(pmcData: IPmcData): number; + protected getQuestMoneyRewardBonus(pmcData: IPmcData): number; /** - * Find quest with 'findItem' requirement that needs the item tpl be handed in + * Find quest with 'findItem' condition that needs the item tpl be handed in * @param itemTpl item tpl to look for - * @returns 'FindItem' condition id + * @param questIds Quests to search through for the findItem condition + * @returns quest id with 'FindItem' condition id */ - getFindItemIdForQuestHandIn(itemTpl: string): string[]; + getFindItemConditionByQuestItem(itemTpl: string, questIds: string[], allQuests: IQuest[]): Record; /** * Add all quests to a profile with the provided statuses * @param pmcProfile profile to update diff --git a/types/helpers/RagfairOfferHelper.d.ts b/types/helpers/RagfairOfferHelper.d.ts index 9392c82..0699259 100644 --- a/types/helpers/RagfairOfferHelper.d.ts +++ b/types/helpers/RagfairOfferHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; @@ -13,10 +14,10 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { LocaleService } from "../services/LocaleService"; import { LocalisationService } from "../services/LocalisationService"; +import { MailSendService } from "../services/MailSendService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { PresetHelper } from "./PresetHelper"; @@ -33,7 +34,6 @@ export declare class RagfairOfferHelper { protected databaseServer: DatabaseServer; protected traderHelper: TraderHelper; protected saveServer: SaveServer; - protected dialogueHelper: DialogueHelper; protected itemHelper: ItemHelper; protected paymentHelper: PaymentHelper; protected presetHelper: PresetHelper; @@ -44,15 +44,16 @@ export declare class RagfairOfferHelper { protected ragfairOfferService: RagfairOfferService; protected localeService: LocaleService; protected localisationService: LocalisationService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; protected static goodSoldTemplate: string; 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, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see - * @param searchRequest - * @param itemsToAdd + * @param searchRequest Data from client + * @param itemsToAdd ragfairHelper.filterCategories() * @param traderAssorts Trader assorts * @param pmcProfile Player profile * @returns Offers the player should see @@ -67,6 +68,13 @@ export declare class RagfairOfferHelper { * @returns IRagfairOffer array */ getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Check if offer is from trader standing the player does not have + * @param offer Offer to check + * @param pmcProfile Player profile + * @returns True if item is locked, false if item is purchaseable + */ + protected traderOfferLockedBehindLoyaltyLevel(offer: IRagfairOffer, pmcProfile: IPmcData): boolean; /** * Check if offer item is quest locked for current player by looking at sptQuestLocked property in traders barter_scheme * @param offer Offer to check is quest locked @@ -112,27 +120,42 @@ export declare class RagfairOfferHelper { */ protected getProfileOffers(sessionID: string): IRagfairOffer[]; /** - * Delete an offer from a desired profile + * Delete an offer from a desired profile and from ragfair offers * @param sessionID Session id of profile to delete offer from - * @param offerId Offer id to delete + * @param offerId Id of offer to delete */ - protected deleteOfferByOfferId(sessionID: string, offerId: string): void; + protected deleteOfferById(sessionID: string, offerId: string): void; /** * Complete the selling of players' offer * @param sessionID Session id * @param offer Sold offer details * @param boughtAmount Amount item was purchased for - * @returns Client response + * @returns IItemEventRouterResponse */ protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; + /** + * Get a localised message for when players offer has sold on flea + * @param itemTpl Item sold + * @param boughtAmount How many were purchased + * @returns Localised message text + */ + protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; /** * Should a ragfair offer be visible to the player - * @param info Search request + * @param searchRequest Search request * @param itemsToAdd ? * @param traderAssorts Trader assort items * @param offer The flea offer * @param pmcProfile Player profile * @returns True = should be shown to player */ - isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + /** + * Is items quality value within desired range + * @param item Item to check quality of + * @param min Desired minimum quality + * @param max Desired maximum quality + * @returns True if in range + */ + protected itemQualityInRange(item: Item, min: number, max: number): boolean; } diff --git a/types/helpers/RagfairSellHelper.d.ts b/types/helpers/RagfairSellHelper.d.ts index 251d7ca..913b408 100644 --- a/types/helpers/RagfairSellHelper.d.ts +++ b/types/helpers/RagfairSellHelper.d.ts @@ -13,12 +13,12 @@ export declare class RagfairSellHelper { constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); /** * 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 + * @param qualityMultiplier Quality multipler of item being sold * @returns percent value */ - calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + calculateSellChance(averageOfferPriceRub: number, playerListedPriceRub: number, qualityMultiplier: 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 diff --git a/types/helpers/RepairHelper.d.ts b/types/helpers/RepairHelper.d.ts index 0d0257a..3ba54f6 100644 --- a/types/helpers/RepairHelper.d.ts +++ b/types/helpers/RepairHelper.d.ts @@ -21,6 +21,7 @@ export declare class RepairHelper { * @param isArmor Is item being repaired a piece of armor * @param amountToRepair how many unit of durability to repair * @param useRepairKit Is item being repaired with a repair kit + * @param traderQualityMultipler Trader quality value from traders base json * @param applyMaxDurabilityDegradation should item have max durability reduced */ updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit: boolean, traderQualityMultipler: number, applyMaxDurabilityDegradation?: boolean): void; diff --git a/types/helpers/TradeHelper.d.ts b/types/helpers/TradeHelper.d.ts index 8f82365..28512f1 100644 --- a/types/helpers/TradeHelper.d.ts +++ b/types/helpers/TradeHelper.d.ts @@ -39,12 +39,13 @@ export declare class TradeHelper { buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; /** * Sell item to trader - * @param pmcData Profile to update + * @param profileWithItemsToSell Profile to remove items from + * @param profileToReceiveMoney Profile to accept the money for selling item * @param sellRequest Request data * @param sessionID Session id * @returns IItemEventRouterResponse */ - sellItem(pmcData: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; + sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse; /** * Increment the assorts buy count by number of items purchased * Show error on screen if player attempts to buy more than what the buy max allows diff --git a/types/helpers/TraderHelper.d.ts b/types/helpers/TraderHelper.d.ts index 4157c1c..7eb4edf 100644 --- a/types/helpers/TraderHelper.d.ts +++ b/types/helpers/TraderHelper.d.ts @@ -1,4 +1,6 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ProfileTraderTemplate } from "../models/eft/common/tables/IProfileTemplate"; import { ITraderAssort, ITraderBase, LoyaltyLevel } from "../models/eft/common/tables/ITrader"; import { Traders } from "../models/enums/Traders"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; @@ -34,7 +36,19 @@ export declare class TraderHelper { protected highestTraderBuyPriceItems: Record; constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; - getTraderAssortsById(traderId: string): ITraderAssort; + /** + * Get all assort data for a particular trader + * @param traderId Trader to get assorts for + * @returns ITraderAssort + */ + getTraderAssortsByTraderId(traderId: string): ITraderAssort; + /** + * Retrieve the Item from a traders assort data by its id + * @param traderId Trader to get assorts for + * @param assortId Id of assort to find + * @returns Item object + */ + getTraderAssortItemByAssortId(traderId: string, assortId: string): Item; /** * Reset a profiles trader data back to its initial state as seen by a level 1 player * Does NOT take into account different profile levels @@ -42,6 +56,7 @@ export declare class TraderHelper { * @param traderID trader id to reset */ resetTrader(sessionID: string, traderID: string): void; + protected getStartingStanding(traderId: string, rawProfileTemplate: ProfileTraderTemplate): number; /** * Alter a traders unlocked status * @param traderId Trader to alter @@ -65,10 +80,10 @@ export declare class TraderHelper { protected addStandingValuesTogether(currentStanding: number, standingToAdd: number): number; /** * Calculate traders level based on exp amount and increments level if over threshold - * @param traderID trader to process - * @param sessionID session id + * @param traderID trader to check standing of + * @param pmcData profile to update trader in */ - lvlUp(traderID: string, sessionID: string): void; + lvlUp(traderID: string, pmcData: IPmcData): void; /** * Get the next update timestamp for a trader * @param traderID Trader to look up update value for @@ -113,4 +128,31 @@ export declare class TraderHelper { * @returns Traders key */ getTraderById(traderId: string): Traders; + /** + * Validates that the provided traderEnumValue exists in the Traders enum. If the value is valid, it returns the + * same enum value, effectively serving as a trader ID; otherwise, it logs an error and returns an empty string. + * This method provides a runtime check to prevent undefined behavior when using the enum as a dictionary key. + * + * For example, instead of this: + * `const traderId = Traders[Traders.PRAPOR];` + * + * You can use safely use this: + * `const traderId = this.traderHelper.getValidTraderIdByEnumValue(Traders.PRAPOR);` + * + * @param traderEnumValue The trader enum value to validate + * @returns The validated trader enum value as a string, or an empty string if invalid + */ + getValidTraderIdByEnumValue(traderEnumValue: Traders): string; + /** + * Does the 'Traders' enum has a value that matches the passed in parameter + * @param key Value to check for + * @returns True, values exists in Traders enum as a value + */ + traderEnumHasKey(key: string): boolean; + /** + * Accepts a trader id + * @param traderId Trader id + * @returns Ttrue if Traders enum has the param as a value + */ + traderEnumHasValue(traderId: string): boolean; } diff --git a/types/helpers/WeightedRandomHelper.d.ts b/types/helpers/WeightedRandomHelper.d.ts index a978f96..5fd9edc 100644 --- a/types/helpers/WeightedRandomHelper.d.ts +++ b/types/helpers/WeightedRandomHelper.d.ts @@ -1,6 +1,6 @@ export declare class WeightedRandomHelper { /** - * USE getWeightedValue() WHERE POSSIBLE + * @deprecated USE getWeightedValue() WHERE POSSIBLE * Gets a tplId from a weighted dictionary * @param {tplId: weighting[]} itemArray * @returns tplId diff --git a/types/loaders/PreAkiModLoader.d.ts b/types/loaders/PreAkiModLoader.d.ts index a67f1c9..a1664e1 100644 --- a/types/loaders/PreAkiModLoader.d.ts +++ b/types/loaders/PreAkiModLoader.d.ts @@ -25,6 +25,8 @@ export declare class PreAkiModLoader implements IModLoader { protected order: Record; protected imported: Record; protected akiConfig: ICoreConfig; + protected serverDependencies: Record; + protected skippedMods: string[]; constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer, modTypeCheck: ModTypeCheck); load(container: DependencyContainer): Promise; /** @@ -35,6 +37,7 @@ export declare class PreAkiModLoader implements IModLoader { getImportedModDetails(): Record; getModPath(mod: string): string; protected importMods(): Promise; + protected sortMods(prev: string, next: string, missingFromOrderJSON: Record): number; /** * Check for duplicate mods loaded, show error if any * @param modPackageData Dictionary of mod package.json data @@ -62,6 +65,7 @@ export declare class PreAkiModLoader implements IModLoader { protected executeMods(container: DependencyContainer): Promise; sortModsLoadOrder(): string[]; protected addMod(mod: string): Promise; + protected autoInstallDependencies(modPath: string, pkg: IPackageJsonData): void; protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record): boolean; protected isModCompatible(mod: IPackageJsonData, loadedMods: Record): boolean; /** diff --git a/types/models/eft/common/IGlobals.d.ts b/types/models/eft/common/IGlobals.d.ts index 1d3c754..c774511 100644 --- a/types/models/eft/common/IGlobals.d.ts +++ b/types/models/eft/common/IGlobals.d.ts @@ -29,6 +29,7 @@ export interface IConfig { TradingUnlimitedItems: boolean; MaxLoyaltyLevelForAll: boolean; GlobalLootChanceModifier: number; + GraphicSettings: IGraphicSettings; TimeBeforeDeploy: number; TimeBeforeDeployLocal: number; TradingSetting: number; @@ -79,6 +80,7 @@ export interface IConfig { SkillExpPerLevel: number; GameSearchingTimeout: number; WallContusionAbsorption: Ixyz; + WeaponFastDrawSettings: IWeaponFastDrawSettings; SkillsSettings: ISkillsSettings; AzimuthPanelShowsPlayerOrientation: boolean; Aiming: IAiming; @@ -90,6 +92,19 @@ export interface IConfig { Ballistic: IBallistic; RepairSettings: IRepairSettings; } +export interface IWeaponFastDrawSettings { + HandShakeCurveFrequency: number; + HandShakeCurveIntensity: number; + HandShakeMaxDuration: number; + HandShakeTremorIntensity: number; + WeaponFastSwitchMaxSpeedMult: number; + WeaponFastSwitchMinSpeedMult: number; + WeaponPistolFastSwitchMaxSpeedMult: number; + WeaponPistolFastSwitchMinSpeedMult: number; +} +export interface IGraphicSettings { + ExperimentalFogInCity: boolean; +} export interface IBufferZone { CustomerAccessTime: number; CustomerCriticalTimeStart: number; @@ -146,7 +161,11 @@ export interface IKill { expOnDamageAllHealth: number; longShotDistance: number; bloodLossToLitre: number; + botExpOnDamageAllHealth: number; + botHeadShotMult: number; victimBotLevelExp: number; + pmcExpOnDamageAllHealth: number; + pmcHeadShotMult: number; } export interface ICombo { percent: number; @@ -756,6 +775,7 @@ export interface IStamina { OverweightConsumptionByPose: Ixyz; AimingSpeedMultiplier: number; WalkVisualEffectMultiplier: number; + WeaponFastSwitchConsumption: number; HandsCapacity: number; HandsRestoration: number; ProneConsumption: number; @@ -1215,6 +1235,11 @@ export interface IFenceLevel { ScavAttackSupport: boolean; ExfiltrationPriceModifier: number; AvailableExits: number; + BotApplySilenceChance: number; + BotGetInCoverChance: number; + BotHelpChance: number; + BotSpreadoutChance: number; + BotStopChance: number; } export interface IInertia { InertiaLimits: Ixyz; diff --git a/types/models/eft/common/ILocation.d.ts b/types/models/eft/common/ILocation.d.ts index 42fac06..f26ade6 100644 --- a/types/models/eft/common/ILocation.d.ts +++ b/types/models/eft/common/ILocation.d.ts @@ -3,4 +3,18 @@ import { ILooseLoot } from "./ILooseLoot"; export interface ILocation { base: ILocationBase; looseLoot: ILooseLoot; + statics: IStaticContainer; +} +export interface IStaticContainer { + containersGroups: Record; + containers: Record; +} +export interface IContainerMinMax { + minContainers: number; + maxContainers: number; + current?: number; + chosenCount?: number; +} +export interface IContainerData { + groupId: string; } diff --git a/types/models/eft/common/ILocationBase.d.ts b/types/models/eft/common/ILocationBase.d.ts index f064225..5f24907 100644 --- a/types/models/eft/common/ILocationBase.d.ts +++ b/types/models/eft/common/ILocationBase.d.ts @@ -18,6 +18,8 @@ export interface ILocationBase { BotMaxPlayer: number; BotMaxTimePlayer: number; BotNormal: number; + BotSpawnCountStep: number; + BotSpawnPeriodCheck: number; BotSpawnTimeOffMax: number; BotSpawnTimeOffMin: number; BotSpawnTimeOnMax: number; @@ -30,6 +32,7 @@ export interface ILocationBase { Enabled: boolean; EnableCoop: boolean; GlobalLootChanceModifier: number; + GlobalContainerChanceModifier: number; IconX: number; IconY: number; Id: string; @@ -47,6 +50,7 @@ export interface ILocationBase { MinPlayers: number; MaxCoopGroup: number; Name: string; + NonWaveGroupScenario: INonWaveGroupScenario; NewSpawn: boolean; OcculsionCullingEnabled: boolean; OldSpawn: boolean; @@ -85,6 +89,12 @@ export interface ILocationBase { users_summon_seconds: number; waves: Wave[]; } +export interface INonWaveGroupScenario { + Chance: number; + Enabled: boolean; + MaxToBeGroup: number; + MinToBeGroup: number; +} export interface ILimit extends MinMax { items: any[]; } @@ -207,6 +217,7 @@ export interface Wave { time_max: number; time_min: number; sptId?: string; + ChanceGroup?: number; } export declare enum WildSpawnType { ASSAULT = "assault", diff --git a/types/models/eft/common/ILooseLoot.d.ts b/types/models/eft/common/ILooseLoot.d.ts index f8ea0c7..09696d4 100644 --- a/types/models/eft/common/ILooseLoot.d.ts +++ b/types/models/eft/common/ILooseLoot.d.ts @@ -16,11 +16,12 @@ export interface SpawnpointsForced { } export interface SpawnpointTemplate { Id: string; - IsStatic: boolean; + IsContainer: boolean; useGravity: boolean; randomRotation: boolean; Position: Ixyz; Rotation: Ixyz; + IsAlwaysSpawn: boolean; IsGroupPosition: boolean; GroupPositions: any[]; Root: string; diff --git a/types/models/eft/common/IPmcData.d.ts b/types/models/eft/common/IPmcData.d.ts index 5703e4b..4e37b60 100644 --- a/types/models/eft/common/IPmcData.d.ts +++ b/types/models/eft/common/IPmcData.d.ts @@ -1,3 +1,7 @@ -import { IBotBase } from "./tables/IBotBase"; +import { IBotBase, IEftStats } from "./tables/IBotBase"; export interface IPmcData extends IBotBase { } +export interface IPostRaidPmcData extends IBotBase { + /** Only found in profile we get from client post raid */ + EftStats: IEftStats; +} diff --git a/types/models/eft/common/tables/IBotBase.d.ts b/types/models/eft/common/tables/IBotBase.d.ts index e5d1c30..6c7b76f 100644 --- a/types/models/eft/common/tables/IBotBase.d.ts +++ b/types/models/eft/common/tables/IBotBase.d.ts @@ -6,7 +6,9 @@ import { Item, Upd } from "./IItem"; import { IPmcDataRepeatableQuest } from "./IRepeatableQuests"; export interface IBotBase { _id: string; - aid: string; + aid: number; + /** SPT property - use to store player id - TODO - move to AID ( account id as guid of choice) */ + sessionId: string; savage?: string; Info: Info; Customization: Customization; @@ -19,7 +21,7 @@ export interface IBotBase { BackendCounters: Record; InsuredItems: InsuredItem[]; Hideout: Hideout; - Quests: Quest[]; + Quests: IQuestStatus[]; TradersInfo: Record; UnlockedInfo: IUnlockedInfo; RagfairInfo: RagfairInfo; @@ -121,6 +123,8 @@ export interface Inventory { sortingTable: string; questRaidItems: string; questStashItems: string; + /** Key is hideout area enum numeric as string e.g. "24", value is area _id */ + hideoutAreaStashes: Record; fastPanel: Record; } export interface IBaseJsonSkills { @@ -146,6 +150,9 @@ export interface Common extends IBaseSkill { export interface Mastering extends IBaseSkill { } export interface Stats { + Eft: IEftStats; +} +export interface IEftStats { CarriedQuestItems: string[]; Victims: Victim[]; TotalSessionExperience: number; @@ -267,13 +274,14 @@ export interface BackendCounter { value: number; } export interface InsuredItem { + /** Trader Id item was insured by */ tid: string; itemId: string; } export interface Hideout { Production: Record; Areas: HideoutArea[]; - Improvements: Record; + Improvement: Record; Seed: number; sptUpdateLastRunTimestamp: number; } @@ -291,6 +299,12 @@ export interface Productive { SkipTime?: number; /** Seconds needed to fully craft */ ProductionTime?: number; + GivenItemsInStart?: string[]; + Interrupted?: boolean; + /** Used in hideout prodiction.json */ + needFuelForAllProductionTime?: boolean; + /** Used when sending data to client */ + NeedFuelForAllProductionTime?: boolean; sptIsScavCase?: boolean; } export interface Production extends Productive { @@ -341,7 +355,7 @@ export declare enum SurvivorClass { PARAMEDIC = 3, SURVIVOR = 4 } -export interface Quest { +export interface IQuestStatus { qid: string; startTime: number; status: QuestStatus; @@ -353,10 +367,18 @@ export interface Quest { export interface TraderInfo { loyaltyLevel: number; salesSum: number; - disabled: boolean; standing: number; nextResupply: number; unlocked: boolean; + disabled: boolean; +} +/** This object is sent to the client as part of traderRelations */ +export interface TraderData { + salesSum: number; + standing: number; + loyalty: number; + unlocked: boolean; + disabled: boolean; } export interface RagfairInfo { rating: number; diff --git a/types/models/eft/common/tables/IBotType.d.ts b/types/models/eft/common/tables/IBotType.d.ts index 24b36a4..7a9fbed 100644 --- a/types/models/eft/common/tables/IBotType.d.ts +++ b/types/models/eft/common/tables/IBotType.d.ts @@ -101,18 +101,22 @@ export interface Experience { standingForKill: number; } export interface Generation { - items: ItemMinMax; + items: GenerationWeightingItems; } -export interface ItemMinMax { - grenades: MinMaxWithWhitelist; - healing: MinMaxWithWhitelist; - drugs: MinMaxWithWhitelist; - stims: MinMaxWithWhitelist; - looseLoot: MinMaxWithWhitelist; - magazines: MinMaxWithWhitelist; - specialItems: MinMaxWithWhitelist; +export interface GenerationWeightingItems { + grenades: GenerationData; + healing: GenerationData; + drugs: GenerationData; + stims: GenerationData; + backpackLoot: GenerationData; + pocketLoot: GenerationData; + vestLoot: GenerationData; + magazines: GenerationData; + specialItems: GenerationData; } -export interface MinMaxWithWhitelist extends MinMax { +export interface GenerationData { + /** key: number of items, value: weighting */ + weights: Record; /** Array of item tpls */ whitelist: string[]; } diff --git a/types/models/eft/common/tables/IItem.d.ts b/types/models/eft/common/tables/IItem.d.ts index ce00ae9..09a239c 100644 --- a/types/models/eft/common/tables/IItem.d.ts +++ b/types/models/eft/common/tables/IItem.d.ts @@ -12,6 +12,7 @@ export interface Upd { Togglable?: Togglable; Map?: Map; Tag?: Tag; + /** SPT specific property, not made by BSG */ sptPresetId?: string; FaceShield?: FaceShield; StackObjectsCount?: number; diff --git a/types/models/eft/common/tables/ILootBase.d.ts b/types/models/eft/common/tables/ILootBase.d.ts index 8b86d13..681c32f 100644 --- a/types/models/eft/common/tables/ILootBase.d.ts +++ b/types/models/eft/common/tables/ILootBase.d.ts @@ -11,31 +11,30 @@ export interface IStaticAmmoDetails { } export interface IStaticContainerDetails { staticWeapons: IStaticWeaponProps[]; - staticContainers: IStaticContainerProps[]; + staticContainers: IStaticContainerData[]; staticForced: IStaticForcedProps[]; } -export interface IStaticWeaponProps { +export interface IStaticContainerData { + probability: number; + template: IStaticContainerProps; +} +export interface IStaticPropsBase { Id: string; - IsStatic: boolean; + IsContainer: boolean; useGravity: boolean; randomRotation: boolean; Position: Ixyz; Rotation: Ixyz; IsGroupPosition: boolean; + IsAlwaysSpawn: boolean; GroupPositions: any[]; Root: string; + Items: any[]; +} +export interface IStaticWeaponProps extends IStaticPropsBase { Items: Item[]; } -export interface IStaticContainerProps { - Id: string; - IsStatic: boolean; - useGravity: boolean; - randomRotation: boolean; - Position: Ixyz; - Rotation: Ixyz; - IsGroupPosition: boolean; - GroupPositions: any[]; - Root: string; +export interface IStaticContainerProps extends IStaticPropsBase { Items: StaticItem[]; } export interface StaticItem { diff --git a/types/models/eft/common/tables/IMatch.d.ts b/types/models/eft/common/tables/IMatch.d.ts index c30cb48..042f5bb 100644 --- a/types/models/eft/common/tables/IMatch.d.ts +++ b/types/models/eft/common/tables/IMatch.d.ts @@ -7,4 +7,5 @@ export interface Metrics { RenderBins: number[]; GameUpdateBins: number[]; MemoryMeasureInterval: number; + PauseReasons: number[]; } diff --git a/types/models/eft/common/tables/IProfileTemplate.d.ts b/types/models/eft/common/tables/IProfileTemplate.d.ts index 66ebbe8..08280e2 100644 --- a/types/models/eft/common/tables/IProfileTemplate.d.ts +++ b/types/models/eft/common/tables/IProfileTemplate.d.ts @@ -1,4 +1,4 @@ -import { Dialogue, WeaponBuild } from "../../profile/IAkiProfile"; +import { Dialogue, IUserBuilds } from "../../profile/IAkiProfile"; import { IPmcData } from "../IPmcData"; export interface IProfileTemplates { Standard: IProfileSides; @@ -14,7 +14,7 @@ export interface TemplateSide { character: IPmcData; suits: string[]; dialogues: Record; - weaponbuilds: WeaponBuild[]; + userbuilds: IUserBuilds; trader: ProfileTraderTemplate; } export interface ProfileTraderTemplate { diff --git a/types/models/eft/common/tables/IQuest.d.ts b/types/models/eft/common/tables/IQuest.d.ts index fa636b4..300a027 100644 --- a/types/models/eft/common/tables/IQuest.d.ts +++ b/types/models/eft/common/tables/IQuest.d.ts @@ -32,6 +32,8 @@ export interface IQuest { changeQuestMessageText: string; /** "Pmc" or "Scav" */ side: string; + /** Status of quest to player */ + sptStatus?: QuestStatus; } export interface Conditions { Started: AvailableForConditions[]; @@ -69,6 +71,7 @@ export interface AvailableForProps { zoneId?: string; type?: boolean; countInRaid?: boolean; + globalQuestCounterId?: any; } export interface AvailableForCounter { id: string; diff --git a/types/models/eft/common/tables/ITemplateItem.d.ts b/types/models/eft/common/tables/ITemplateItem.d.ts index d8615fb..147847b 100644 --- a/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/types/models/eft/common/tables/ITemplateItem.d.ts @@ -9,6 +9,7 @@ export interface ITemplateItem { } export interface Props { AllowSpawnOnLocations?: any[]; + BeltMagazineRefreshCount?: number; ChangePriceCoef?: number; FixedPrice?: boolean; SendToClient?: boolean; @@ -83,6 +84,7 @@ export interface Props { Velocity?: number; RaidModdable?: boolean; ToolModdable?: boolean; + UniqueAnimationModID?: number; BlocksFolding?: boolean; BlocksCollapsible?: boolean; IsAnimated?: boolean; @@ -106,10 +108,12 @@ export interface Props { Intensity?: number; Mask?: string; MaskSize?: number; + IsMagazineForStationaryWeapon?: boolean; NoiseIntensity?: number; NoiseScale?: number; Color?: IColor; DiffuseIntensity?: number; + MagazineWithBelt?: boolean; HasHinge?: boolean; RampPalette?: string; DepthFade?: number; @@ -212,6 +216,7 @@ export interface Props { MinRepairDegradation?: number; MaxRepairDegradation?: number; IronSightRange?: number; + IsBeltMachineGun?: boolean; IsFlareGun?: boolean; IsGrenadeLauncher?: boolean; IsOneoff?: boolean; @@ -259,7 +264,7 @@ export interface Props { CutoffFreq?: number; Resonance?: number; RolloffMultiplier?: number; - ReverbVolume: number; + ReverbVolume?: number; CompressorVolume?: number; AmbientVolume?: number; DryVolume?: number; diff --git a/types/models/eft/game/IGameConfigResponse.d.ts b/types/models/eft/game/IGameConfigResponse.d.ts index e1b7587..2bff352 100644 --- a/types/models/eft/game/IGameConfigResponse.d.ts +++ b/types/models/eft/game/IGameConfigResponse.d.ts @@ -1,11 +1,12 @@ export interface IGameConfigResponse { - aid: string; + aid: number; lang: string; languages: Record; ndaFree: boolean; taxonomy: number; activeProfileId: string; backend: Backend; + useProtobuf: boolean; utc_time: number; /** Total in game time */ totalInGame: number; diff --git a/types/models/eft/health/IHealthTreatmentRequestData.d.ts b/types/models/eft/health/IHealthTreatmentRequestData.d.ts index 7fb80a8..598e60c 100644 --- a/types/models/eft/health/IHealthTreatmentRequestData.d.ts +++ b/types/models/eft/health/IHealthTreatmentRequestData.d.ts @@ -1,12 +1,14 @@ export interface IHealthTreatmentRequestData { Action: "RestoreHealth"; trader: string; - items: Item[]; + items: Cost[]; difference: Difference; timestamp: number; } -export interface Item { +export interface Cost { + /** Id of stack to take money from */ id: string; + /** Amount of money to take off player for treatment */ count: number; } export interface Difference { @@ -25,5 +27,6 @@ export interface BodyParts { } export interface BodyPart { Health: number; + /** Effects in array are to be removed */ Effects: string[]; } diff --git a/types/models/eft/hideout/IHideoutArea.d.ts b/types/models/eft/hideout/IHideoutArea.d.ts index fa5ca20..bb00498 100644 --- a/types/models/eft/hideout/IHideoutArea.d.ts +++ b/types/models/eft/hideout/IHideoutArea.d.ts @@ -8,6 +8,7 @@ export interface IHideoutArea { craftGivesExp: boolean; displayLevel: boolean; enableAreaRequirements: boolean; + parentArea?: string; stages: Record; } export interface IAreaRequirement { @@ -19,6 +20,8 @@ export interface Stage { autoUpgrade: boolean; bonuses: StageBonus[]; constructionTime: number; + /** Containers inventory tpl */ + container?: string; description: string; displayInterface: boolean; improvements: IStageImprovement[]; @@ -67,6 +70,7 @@ export interface StageBonus { type: string; filter?: string[]; icon?: string; + /** CHANGES PER DUMP */ id?: string; templateId?: string; } diff --git a/types/models/eft/inRaid/IInsuredItemsData.d.ts b/types/models/eft/inRaid/IInsuredItemsData.d.ts new file mode 100644 index 0000000..c49fb79 --- /dev/null +++ b/types/models/eft/inRaid/IInsuredItemsData.d.ts @@ -0,0 +1,6 @@ +export interface IInsuredItemsData { + id: string; + durability?: number; + maxDurability?: number; + hits?: number; +} diff --git a/types/models/eft/inRaid/ISaveProgressRequestData.d.ts b/types/models/eft/inRaid/ISaveProgressRequestData.d.ts index 0b6f091..3fdc994 100644 --- a/types/models/eft/inRaid/ISaveProgressRequestData.d.ts +++ b/types/models/eft/inRaid/ISaveProgressRequestData.d.ts @@ -1,9 +1,11 @@ import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState"; -import { IPmcData } from "../common/IPmcData"; +import { IPostRaidPmcData } from "../common/IPmcData"; import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData"; +import { IInsuredItemsData } from "./IInsuredItemsData"; export interface ISaveProgressRequestData { exit: PlayerRaidEndState; - profile: IPmcData; + profile: IPostRaidPmcData; isPlayerScav: boolean; health: ISyncHealthRequestData; + insurance: IInsuredItemsData[]; } diff --git a/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts b/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts index 6d7c190..6d8a172 100644 --- a/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts +++ b/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts @@ -5,6 +5,7 @@ export interface To { id: string; container: string; location?: ToLocation | number; + isSearched?: boolean; } export interface ToLocation { x: number; diff --git a/types/models/eft/inventory/IInventoryExamineRequestData.d.ts b/types/models/eft/inventory/IInventoryExamineRequestData.d.ts index 614711f..0d5f2db 100644 --- a/types/models/eft/inventory/IInventoryExamineRequestData.d.ts +++ b/types/models/eft/inventory/IInventoryExamineRequestData.d.ts @@ -1,10 +1,7 @@ +import { OwnerInfo } from "../common/request/IBaseInteractionRequestData"; import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; export interface IInventoryExamineRequestData extends IInventoryBaseActionRequestData { Action: "Examine"; item: string; - fromOwner: IFromOwner; -} -export interface IFromOwner { - id: string; - type: string; + fromOwner: OwnerInfo; } diff --git a/types/models/eft/inventory/IInventorySplitRequestData.d.ts b/types/models/eft/inventory/IInventorySplitRequestData.d.ts index 730ae71..1ba0065 100644 --- a/types/models/eft/inventory/IInventorySplitRequestData.d.ts +++ b/types/models/eft/inventory/IInventorySplitRequestData.d.ts @@ -1,7 +1,11 @@ import { Container, IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; export interface IInventorySplitRequestData extends IInventoryBaseActionRequestData { Action: "Split"; - item: string; + /** Id of item to split */ + splitItem: string; + /** Id of new item stack */ + newItem: string; + /** Destination new item will be placed in */ container: Container; count: number; } diff --git a/types/models/eft/itemEvent/IItemEventRouterBase.d.ts b/types/models/eft/itemEvent/IItemEventRouterBase.d.ts index dbf6330..8591294 100644 --- a/types/models/eft/itemEvent/IItemEventRouterBase.d.ts +++ b/types/models/eft/itemEvent/IItemEventRouterBase.d.ts @@ -1,5 +1,5 @@ -import { QuestStatus } from "../../../models/enums/QuestStatus"; -import { Health, Productive, Skills, TraderInfo } from "../common/tables/IBotBase"; +import { EquipmentBuildType } from "../../../models/enums/EquipmentBuildType"; +import { Health, IQuestStatus, Productive, Skills, TraderData } from "../common/tables/IBotBase"; import { Item, Upd } from "../common/tables/IItem"; import { IQuest } from "../common/tables/IQuest"; import { IPmcDataRepeatableQuest } from "../common/tables/IRepeatableQuests"; @@ -20,32 +20,39 @@ export interface ProfileChange { experience: number; quests: IQuest[]; ragFairOffers: IRagfairOffer[]; - builds: BuildChange[]; + weaponBuilds: IWeaponBuildChange[]; + equipmentBuilds: IEquipmentBuildChange[]; items: ItemChanges; production: Record; /** Hideout area improvement id */ improvements: Record; skills: Skills; health: Health; - traderRelations: Record; + traderRelations: Record; repeatableQuests?: IPmcDataRepeatableQuest[]; recipeUnlocked: Record; - questsStatus: QuestStatusChange[]; + changedHideoutStashes?: Record; + questsStatus: IQuestStatus[]; } -export interface QuestStatusChange { - qid: string; - startTime: number; - status: QuestStatus; - statusTimers: Record; - completedConditions: string[]; - availableAfter: number; +export interface IHideoutStashItem { + Id: string; + Tpl: string; } -export interface BuildChange { +export interface IWeaponBuildChange { id: string; name: string; root: string; items: Item[]; } +export interface IEquipmentBuildChange { + id: string; + name: string; + root: string; + items: Item[]; + type: string; + fastpanel: any[]; + buildType: EquipmentBuildType; +} export interface ItemChanges { new: Product[]; change: Product[]; diff --git a/types/models/eft/notifier/INotifier.d.ts b/types/models/eft/notifier/INotifier.d.ts index ce25dee..c6c6979 100644 --- a/types/models/eft/notifier/INotifier.d.ts +++ b/types/models/eft/notifier/INotifier.d.ts @@ -14,6 +14,11 @@ export interface INotification { } export declare enum NotificationType { RAGFAIR_OFFER_SOLD = "RagfairOfferSold", + RAGFAIR_RATING_CHANGE = "RagfairRatingChange", + /** ChatMessageReceived */ NEW_MESSAGE = "new_message", - PING = "ping" + PING = "ping", + TRADER_SUPPLY = "TraderSupply", + TRADER_STANDING = "TraderStanding", + UNLOCK_TRADER = "UnlockTrader" } diff --git a/types/models/eft/notifier/ISelectProfileResponse.d.ts b/types/models/eft/notifier/ISelectProfileResponse.d.ts index ecb668a..f2d6be7 100644 --- a/types/models/eft/notifier/ISelectProfileResponse.d.ts +++ b/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -1,6 +1,3 @@ -import { INotifierChannel } from "./INotifier"; export interface ISelectProfileResponse { status: string; - notifier: INotifierChannel; - notifierServer: string; } diff --git a/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts b/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts index 42549e6..37f7ce1 100644 --- a/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts +++ b/types/models/eft/presetBuild/IPresetBuildActionRequestData.d.ts @@ -1,4 +1,4 @@ -import { Upd } from "../common/tables/IItem"; +import { Item } from "../common/tables/IItem"; export interface IPresetBuildActionRequestData { Action: string; id: string; @@ -6,10 +6,3 @@ export interface IPresetBuildActionRequestData { root: string; items: Item[]; } -export interface Item { - _id: string; - _tpl: string; - upd?: Upd; - parentId?: string; - slotId?: string; -} diff --git a/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts b/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts new file mode 100644 index 0000000..0d61c4b --- /dev/null +++ b/types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts @@ -0,0 +1,4 @@ +export interface IRemoveBuildRequestData { + Action: "RemoveBuild"; + id: string; +} diff --git a/types/models/eft/profile/IAkiProfile.d.ts b/types/models/eft/profile/IAkiProfile.d.ts index d08da6e..cb781c8 100644 --- a/types/models/eft/profile/IAkiProfile.d.ts +++ b/types/models/eft/profile/IAkiProfile.d.ts @@ -1,3 +1,4 @@ +import { EquipmentBuildType } from "../../../models/enums/EquipmentBuildType"; import { MemberCategory } from "../../../models/enums/MemberCategory"; import { MessageType } from "../../enums/MessageType"; import { IPmcData } from "../common/IPmcData"; @@ -7,7 +8,7 @@ export interface IAkiProfile { characters: Characters; /** Clothing purchases */ suits: string[]; - weaponbuilds: WeaponBuild[]; + userbuilds: IUserBuilds; dialogues: Record; aki: Aki; vitality: Vitality; @@ -22,6 +23,7 @@ export declare class TraderPurchaseData { } export interface Info { id: string; + aid: number; username: string; password: string; wipe: boolean; @@ -31,11 +33,25 @@ export interface Characters { pmc: IPmcData; scav: IPmcData; } -export interface WeaponBuild { +export interface IUserBuilds { + weaponBuilds: IWeaponBuild[]; + equipmentBuilds: IEquipmentBuild[]; +} +export interface IWeaponBuild { id: string; name: string; root: string; items: Item[]; + type: string; +} +export interface IEquipmentBuild { + id: string; + name: string; + root: string; + items: Item[]; + type: string; + fastPanel: Record; + buildType: EquipmentBuildType; } export interface Dialogue { attachmentsNew: number; @@ -74,7 +90,7 @@ export interface Message { Member?: IUpdatableChatMember; templateId?: string; text?: string; - hasRewards: boolean; + hasRewards?: boolean; rewardCollected: boolean; items?: MessageItems; maxStorageTime?: number; diff --git a/types/models/eft/ragfair/IStorePlayerOfferTaxAmountRequestData.d.ts b/types/models/eft/ragfair/IStorePlayerOfferTaxAmountRequestData.d.ts new file mode 100644 index 0000000..ebf470e --- /dev/null +++ b/types/models/eft/ragfair/IStorePlayerOfferTaxAmountRequestData.d.ts @@ -0,0 +1,6 @@ +export interface IStorePlayerOfferTaxAmountRequestData { + id: string; + tpl: string; + count: number; + fee: number; +} diff --git a/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts b/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts new file mode 100644 index 0000000..c0be040 --- /dev/null +++ b/types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts @@ -0,0 +1,6 @@ +import { OwnerInfo } from "../common/request/IBaseInteractionRequestData"; +export interface ISellScavItemsToFenceRequestData { + Action: "SellAllFromSavage"; + fromOwner: OwnerInfo; + toOwner: OwnerInfo; +} diff --git a/types/models/enums/AccountTypes.d.ts b/types/models/enums/AccountTypes.d.ts new file mode 100644 index 0000000..79d74d5 --- /dev/null +++ b/types/models/enums/AccountTypes.d.ts @@ -0,0 +1,3 @@ +export declare enum AccountTypes { + SPT_DEVELOPER = "spt developer" +} diff --git a/types/models/enums/BackendErrorCodes.d.ts b/types/models/enums/BackendErrorCodes.d.ts index 6614b75..2a269b5 100644 --- a/types/models/enums/BackendErrorCodes.d.ts +++ b/types/models/enums/BackendErrorCodes.d.ts @@ -6,6 +6,7 @@ export declare enum BackendErrorCodes { WRONG_AUTHORIZATION_CODE = 211, NEED_CAPTCHA = 214, NO_NEED_CAPTCHA = 215, + CAPTCHA_INVALID_ANSWER = 216, CAPTCHA_FAILED = 218, CAPTCHA_BRUTE_FORCED = 219, NO_ROOM_IN_STASH = 223, @@ -15,6 +16,7 @@ export declare enum BackendErrorCodes { REPORT_NOT_ALLOWED = 238, NICKNAME_IS_ABUSIVE = 241, NICKNAME_CHANGE_TIMEOUT = 242, + NOT_ENOUGH_SPACE_TO_UNPACK = 257, NOT_MODIFIED = 304, HTTP_BAD_REQUEST = 400, HTTP_NOT_AUTHORIZED = 401, @@ -63,5 +65,21 @@ export declare enum BackendErrorCodes { EXAMINATIONFAILED = 22001, ITEMALREADYEXAMINED = 22002, UNKNOWNNGINXERROR = 9000, - PARSERESPONSEERROR = 9001 + PARSERESPONSEERROR = 9001, + UNKNOWNMATCHMAKERERROR2 = 503000, + UNKNOWNGROUPERROR = 502000, + GROUPREQUESTNOTFOUND = 502002, + GROUPFULL = 502004, + PLAYERALREADYINGROUP = 502005, + PLAYERNOTINGROUP = 502006, + PLAYERNOTLEADER = 502007, + CANTCHANGEREADYSTATE = 502010, + PLAYERFORBIDDENGROUPINVITES = 502011, + LEADERALREADYREADY = 502012, + GROUPSENDINVITEERROR = 502013, + PLAYERISOFFLINE = 502014, + PLAYERISNOTSEARCHINGFORGROUP = 502018, + PLAYERALREADYLOOKINGFORGAME = 503001, + PLAYERINRAID = 503002, + LIMITFORPRESETSREACHED = 504001 } diff --git a/types/models/enums/BaseClasses.d.ts b/types/models/enums/BaseClasses.d.ts index cd7f5cd..76938ad 100644 --- a/types/models/enums/BaseClasses.d.ts +++ b/types/models/enums/BaseClasses.d.ts @@ -3,6 +3,7 @@ export declare enum BaseClasses { UBGL = "55818b014bdc2ddc698b456b", ARMOR = "5448e54d4bdc2dcc718b4568", ARMOREDEQUIPMENT = "57bef4c42459772e8d35a53b", + REPAIR_KITS = "616eb7aea207f41933308f46", HEADWEAR = "5a341c4086f77401f2541505", FACECOVER = "5a341c4686f77469e155819e", VEST = "5448e5284bdc2dcb718b4567", diff --git a/types/models/enums/ConfigTypes.d.ts b/types/models/enums/ConfigTypes.d.ts index e01425c..27340c4 100644 --- a/types/models/enums/ConfigTypes.d.ts +++ b/types/models/enums/ConfigTypes.d.ts @@ -1,6 +1,7 @@ export declare enum ConfigTypes { AIRDROP = "aki-airdrop", BOT = "aki-bot", + PMC = "aki-pmc", CORE = "aki-core", HEALTH = "aki-health", HIDEOUT = "aki-hideout", @@ -11,6 +12,7 @@ export declare enum ConfigTypes { ITEM = "aki-item", LOCALE = "aki-locale", LOCATION = "aki-location", + LOOT = "aki-loot", MATCH = "aki-match", PLAYERSCAV = "aki-playerscav", PMC_CHAT_RESPONSE = "aki-pmcchatresponse", diff --git a/types/models/enums/EquipmentBuildType.d.ts b/types/models/enums/EquipmentBuildType.d.ts new file mode 100644 index 0000000..d98463f --- /dev/null +++ b/types/models/enums/EquipmentBuildType.d.ts @@ -0,0 +1,4 @@ +export declare enum EquipmentBuildType { + CUSTOM = 0, + STANDARD = 1 +} diff --git a/types/models/enums/HideoutAreas.d.ts b/types/models/enums/HideoutAreas.d.ts index c8313d9..1af487a 100644 --- a/types/models/enums/HideoutAreas.d.ts +++ b/types/models/enums/HideoutAreas.d.ts @@ -23,5 +23,7 @@ export declare enum HideoutAreas { BITCOIN_FARM = 20, CHRISTMAS_TREE = 21, EMERGENCY_WALL = 22, - GYM = 23 + GYM = 23, + WEAPON_STAND = 24, + WEAPON_STAND_SECONDARY = 25 } diff --git a/types/models/enums/ItemAddedResult.d.ts b/types/models/enums/ItemAddedResult.d.ts new file mode 100644 index 0000000..e64b660 --- /dev/null +++ b/types/models/enums/ItemAddedResult.d.ts @@ -0,0 +1,4 @@ +export declare enum ItemAddedResult { + SUCCESS = 1, + NO_SPACE = 2 +} diff --git a/types/models/enums/ItemEventActions.d.ts b/types/models/enums/ItemEventActions.d.ts index 94061f8..64339f1 100644 --- a/types/models/enums/ItemEventActions.d.ts +++ b/types/models/enums/ItemEventActions.d.ts @@ -16,5 +16,10 @@ export declare enum ItemEventActions { DELETE_MAP_MARKER = "DeleteMapMarker", EDIT_MAP_MARKER = "EditMapMarker", OPEN_RANDOM_LOOT_CONTAINER = "OpenRandomLootContainer", - HIDEOUT_QTE_EVENT = "HideoutQuickTimeEvent" + HIDEOUT_QTE_EVENT = "HideoutQuickTimeEvent", + SAVE_WEAPON_BUILD = "SaveWeaponBuild", + REMOVE_WEAPON_BUILD = "RemoveWeaponBuild", + REMOVE_BUILD = "RemoveBuild", + SAVE_EQUIPMENT_BUILD = "SaveEquipmentBuild", + REMOVE_EQUIPMENT_BUILD = "RemoveEquipmentBuild" } diff --git a/types/models/enums/QuestRewardType.d.ts b/types/models/enums/QuestRewardType.d.ts index dde0b33..fee0ad2 100644 --- a/types/models/enums/QuestRewardType.d.ts +++ b/types/models/enums/QuestRewardType.d.ts @@ -7,5 +7,6 @@ export declare enum QuestRewardType { ASSORTMENT_UNLOCK = "AssortmentUnlock", PRODUCTIONS_SCHEME = "ProductionScheme", TRADER_STANDING_RESET = "TraderStandingReset", - TRADER_STANDING_RESTORE = "TraderStandingRestore" + TRADER_STANDING_RESTORE = "TraderStandingRestore", + STASH_ROWS = "StashRows" } diff --git a/types/models/enums/WeatherType.d.ts b/types/models/enums/WeatherType.d.ts index d31fefe..503dc30 100644 --- a/types/models/enums/WeatherType.d.ts +++ b/types/models/enums/WeatherType.d.ts @@ -1,19 +1,19 @@ export declare enum WeatherType { - CLEAR_DAY = 1, - CLEAR_WIND = 2, - CLEAR_NIGHT = 3, - PARTLY_CLOUD_DAY = 4, - PARTLY_CLOUD_NIGHT = 5, - CLEAR_FOG_DAY = 6, - CLEAR_FOG_NIGHT = 7, - CLOUDFOG = 8, - FOG = 9, - MOSTLY_CLOUD = 10, - LIGHT_RAIN = 11, - RAIN = 12, - CLOUD_WIND = 13, - CLOUD_WIND_RAIN = 14, - FULL_CLOUD = 15, - THUNDER_CLOUD = 16, - NONE = 0 + CLEAR_DAY = 0, + CLEAR_WIND = 1, + CLEAR_NIGHT = 2, + PARTLY_CLOUD_DAY = 3, + PARTLY_CLOUD_NIGHT = 4, + CLEAR_FOG_DAY = 5, + CLEAR_FOG_NIGHT = 6, + CLOUD_FOG = 7, + FOG = 8, + MOSTLY_CLOUD = 9, + LIGHT_RAIN = 10, + RAIN = 11, + CLOUD_WIND = 12, + CLOUD_WIND_RAIN = 13, + FULL_CLOUD = 14, + THUNDER_CLOUD = 15, + NONE = 16 } diff --git a/types/models/enums/WildSpawnTypeNumber.d.ts b/types/models/enums/WildSpawnTypeNumber.d.ts index f3a4b36..e8a2b5e 100644 --- a/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/types/models/enums/WildSpawnTypeNumber.d.ts @@ -30,6 +30,12 @@ export declare enum WildSpawnTypeNumber { FOLLOWERBIRDEYE = 28, BOSSZRYACHIY = 29, FOLLOWERZRYACHIY = 30, - ARENAFIGHTER = 31, - ARENAFIGHTEREVENT = 32 + BOSSBOAR = 32, + FOLLOWERBOAR = 33, + ARENAFIGHTER = 34, + ARENAFIGHTEREVENT = 35, + BOSSBOARSNIPER = 36, + CRAZYASSAULTEVENT = 37, + SPTUSEC = 38, + SPTBEAR = 39 } diff --git a/types/models/spt/callbacks/IPresetBuildCallbacks.d.ts b/types/models/spt/callbacks/IPresetBuildCallbacks.d.ts index 97c6487..4865683 100644 --- a/types/models/spt/callbacks/IPresetBuildCallbacks.d.ts +++ b/types/models/spt/callbacks/IPresetBuildCallbacks.d.ts @@ -1,10 +1,12 @@ import { IPmcData } from "../../eft/common/IPmcData"; -import { IPresetBuildActionRequestData } from "../../eft/presetBuild/IPresetBuildActionRequestData"; -import { IItemEventRouterResponse } from "../../eft/itemEvent/IItemEventRouterResponse"; import { IGetBodyResponseData } from "../../eft/httpResponse/IGetBodyResponseData"; -import { WeaponBuild } from "../../eft/profile/IAkiProfile"; +import { IItemEventRouterResponse } from "../../eft/itemEvent/IItemEventRouterResponse"; +import { IPresetBuildActionRequestData } from "../../eft/presetBuild/IPresetBuildActionRequestData"; +import { IWeaponBuild } from "../../eft/profile/IAkiProfile"; export interface IPresetBuildCallbacks { - getHandbookUserlist(url: string, info: any, sessionID: string): IGetBodyResponseData; - saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - removeBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; + getHandbookUserlist(url: string, info: any, sessionID: string): IGetBodyResponseData; + saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; + removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; + saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; + removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/types/models/spt/config/IBotConfig.d.ts b/types/models/spt/config/IBotConfig.d.ts index a536106..65aaa97 100644 --- a/types/models/spt/config/IBotConfig.d.ts +++ b/types/models/spt/config/IBotConfig.d.ts @@ -1,8 +1,7 @@ -import { MinMaxWithWhitelist } from "../../../models/eft/common/tables/IBotType"; +import { GenerationData } from "../../../models/eft/common/tables/IBotType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; import { IBotDurability } from "./IBotDurability"; -import { IPmcConfig } from "./IPmcConfig"; export interface IBotConfig extends IBaseConfig { kind: "aki-bot"; /** How many variants of each bot should be generated on raid start */ @@ -11,12 +10,12 @@ export interface IBotConfig extends IBaseConfig { bosses: string[]; /** Control weapon/armor durability min/max values for each bot type */ durability: IBotDurability; + /** Controls the percentage values of randomization item resources */ + lootItemResourceRandomization: Record; /** Control the weighting of how expensive an average loot item is on a PMC or Scav */ lootNValue: LootNvalue; /** Control what bots are added to a bots revenge list key: bottype, value: bottypes to revenge on seeing their death */ revenge: Record; - /** PMC bot specific config settings */ - pmc: IPmcConfig; /** Control how many items are allowed to spawn on a bot * key: bottype, value: */ itemSpawnLimits: Record>; @@ -24,13 +23,14 @@ export interface IBotConfig extends IBaseConfig { equipment: Record; /** Show a bots botType value after their name */ showTypeInNickname: boolean; + /** What ai brain should a normal scav use per map */ + assaultBrainType: Record>; /** Max number of bots that can be spawned in a raid at any one time */ maxBotCap: Record; + /** Chance scav has fake pscav name e.g. Scav name (player name) */ chanceAssaultScavHasPlayerScavName: number; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; - /** Batch generation size when type not available in cache */ - botGenerationBatchSizePerType: number; } /** Number of bots to generate and store in cache on raid start per bot type */ export interface PresetBatch { @@ -55,6 +55,7 @@ export interface PresetBatch { followerBirdEye: number; followerBigPipe: number; followerTest: number; + followerBoar: number; marksman: number; pmcBot: number; sectantPriest: number; @@ -62,6 +63,13 @@ export interface PresetBatch { gifter: number; test: number; exUsec: number; + arenaFighterEvent: number; + arenaFighter: number; + crazyAssaultEvent: number; + bossBoar: number; + bossBoarSniper: number; + sptUsec: number; + sptBear: number; } export interface LootNvalue { scav: number; @@ -70,13 +78,19 @@ export interface LootNvalue { export interface EquipmentFilters { /** Limits for mod types per weapon .e.g. scopes */ weaponModLimits: ModLimits; - /** Whitelsit for weapons allowed per gun */ + /** Whitelist for weapon sight types allowed per gun */ weaponSightWhitelist: Record; + /** Chance face shield is down/active */ faceShieldIsActiveChancePercent?: number; + /** Chance gun flashlight is active during the day */ lightIsActiveDayChancePercent?: number; + /** Chance gun flashlight is active during the night */ lightIsActiveNightChancePercent?: number; + /** Chance gun laser is active during the day */ laserIsActiveChancePercent?: number; + /** Chance NODS are down/active during the day */ nvgIsActiveChanceDayPercent?: number; + /** Chance NODS are down/active during the night */ nvgIsActiveChanceNightPercent?: number; /** Adjust weighting/chances of items on bot by level of bot */ randomisation: RandomisationDetails[]; @@ -84,9 +98,10 @@ export interface EquipmentFilters { blacklist: EquipmentFilterDetails[]; /** Whitelist equipment by level of bot */ whitelist: EquipmentFilterDetails[]; - clothing: WeightingAdjustmentDetails[]; - /** Adjust clothing choice weighting by level of bot */ - weightingAdjustments: WeightingAdjustmentDetails[]; + /** Adjust equipment/ammo */ + weightingAdjustmentsByBotLevel: WeightingAdjustmentDetails[]; + /** Same as weightingAdjustments but based on player level instead of bot level */ + weightingAdjustmentsByPlayerLevel?: WeightingAdjustmentDetails[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -97,7 +112,7 @@ export interface ModLimits { export interface RandomisationDetails { /** Between what levels do these randomisation setting apply to */ levelRange: MinMax; - generation?: Record; + generation?: Record; /** Mod slots that should be fully randomisate -ignores mods from bottype.json */ randomisedWeaponModSlots?: string[]; /** Armor slots that should be randomised e.g. 'Headwear, Armband' */ @@ -122,10 +137,20 @@ export interface WeightingAdjustmentDetails { ammo?: AdjustmentDetails; /** Key: equipment slot e.g. TacticalVest, value: item tpl + weight */ equipment?: AdjustmentDetails; - /** Key: clothing slor e.g. feet, value: item tpl + weight */ + /** Key: clothing slot e.g. feet, value: item tpl + weight */ clothing?: AdjustmentDetails; } export interface AdjustmentDetails { add: Record>; edit: Record>; } +export interface IRandomisedResourceDetails { + food: IRandomisedResourceValues; + meds: IRandomisedResourceValues; +} +export interface IRandomisedResourceValues { + /** Minimum percent of item to randomized between min and max resource*/ + resourcePercent: number; + /** Chance for randomization to not occur */ + chanceMaxResourcePercent: number; +} diff --git a/types/models/spt/config/ICoreConfig.d.ts b/types/models/spt/config/ICoreConfig.d.ts index d078225..1207359 100644 --- a/types/models/spt/config/ICoreConfig.d.ts +++ b/types/models/spt/config/ICoreConfig.d.ts @@ -6,8 +6,13 @@ export interface ICoreConfig extends IBaseConfig { compatibleTarkovVersion: string; serverName: string; profileSaveIntervalSeconds: number; + sptFriendNickname: string; fixes: IGameFixes; - commit: string; + features: IServerFeatures; + /** Commit hash build server was created from */ + commit?: string; + /** Timestamp of server build */ + buildTime?: string; } export interface IGameFixes { /** Shotguns use a different value than normal guns causing huge pellet dispersion */ @@ -15,3 +20,6 @@ export interface IGameFixes { /** Remove items added by mods when the mod no longer exists - can fix dead profiles stuck at game load*/ removeModItemsFromProfile: boolean; } +export interface IServerFeatures { + autoInstallModDependencies: boolean; +} diff --git a/types/models/spt/config/IHideoutConfig.d.ts b/types/models/spt/config/IHideoutConfig.d.ts index d189939..bedd941 100644 --- a/types/models/spt/config/IHideoutConfig.d.ts +++ b/types/models/spt/config/IHideoutConfig.d.ts @@ -3,6 +3,5 @@ export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; runIntervalSeconds: number; hoursForSkillCrafting: number; - hideoutWallAppearTimeSeconds: number; expCraftAmount: number; } diff --git a/types/models/spt/config/IInRaidConfig.d.ts b/types/models/spt/config/IInRaidConfig.d.ts index c8fa57e..3d3b1a2 100644 --- a/types/models/spt/config/IInRaidConfig.d.ts +++ b/types/models/spt/config/IInRaidConfig.d.ts @@ -12,6 +12,8 @@ export interface IInRaidConfig extends IBaseConfig { carExtractBaseStandingGain: number; /** Fence rep gain when successfully extracting as pscav */ scavExtractGain: number; + /** On death should items in your secure keep their Find in raid status regardless of how you finished the raid */ + keepFiRSecureContainerOnDeath: boolean; } export interface RaidMenuSettings { aiAmount: string; diff --git a/types/models/spt/config/IInsuranceConfig.d.ts b/types/models/spt/config/IInsuranceConfig.d.ts index 9443cb7..b51dc8b 100644 --- a/types/models/spt/config/IInsuranceConfig.d.ts +++ b/types/models/spt/config/IInsuranceConfig.d.ts @@ -7,8 +7,6 @@ export interface IInsuranceConfig extends IBaseConfig { returnChancePercent: Record; /** Item slots that should never be returned as insurance */ blacklistedEquipment: string[]; - /** Names of equipment slots that could not be returned as insurance */ - slotIdsWithChanceOfNotReturning: string[]; /** Override to control how quickly insurance is processed/returned in second */ returnTimeOverrideSeconds: number; /** How often server should process insurance in seconds */ diff --git a/types/models/spt/config/ILocationConfig.d.ts b/types/models/spt/config/ILocationConfig.d.ts index 8d37f60..d1af8b3 100644 --- a/types/models/spt/config/ILocationConfig.d.ts +++ b/types/models/spt/config/ILocationConfig.d.ts @@ -27,6 +27,24 @@ export interface ILocationConfig extends IBaseConfig { enableBotTypeLimits: boolean; /** Add limits to a locations base.MinMaxBots array if enableBotTypeLimits is true*/ botTypeLimits: Record; + /** container randomisation settings */ + containerRandomisationSettings: IContainerRandomistionSettings; + /** How full must a random loose magazine be %*/ + minFillLooseMagazinePercent: number; + /** How full must a random static magazine be %*/ + minFillStaticMagazinePercent: number; + allowDuplicateItemsInStaticContainers: boolean; + /** Key: map, value: loose loot ids to ignore */ + looseLootBlacklist: Record; +} +export interface IContainerRandomistionSettings { + enabled: boolean; + /** What maps can use the container randomisation feature */ + maps: Record; + /** Some container types don't work when randomised */ + containerTypesToNotRandomise: string[]; + containerGroupMinSizeMultiplier: number; + containerGroupMaxSizeMultiplier: number; } export interface IFixEmptyBotWavesSettings { enabled: boolean; diff --git a/types/models/spt/config/ILootConfig.d.ts b/types/models/spt/config/ILootConfig.d.ts new file mode 100644 index 0000000..f7fb472 --- /dev/null +++ b/types/models/spt/config/ILootConfig.d.ts @@ -0,0 +1,9 @@ +import { Spawnpoint } from "../../../models/eft/common/ILooseLoot"; +import { IBaseConfig } from "./IBaseConfig"; +export interface ILootConfig extends IBaseConfig { + kind: "aki-loot"; + /** Spawn positions to add into a map, key=mapid */ + looseLoot: Record; + /** Loose loot probability adjustments to apply on game start */ + looseLootSpawnPointAdjustments: Record>; +} diff --git a/types/models/spt/config/IPlayerScavConfig.d.ts b/types/models/spt/config/IPlayerScavConfig.d.ts index 3a65e83..a10f28f 100644 --- a/types/models/spt/config/IPlayerScavConfig.d.ts +++ b/types/models/spt/config/IPlayerScavConfig.d.ts @@ -1,4 +1,4 @@ -import { MinMax } from "../../common/MinMax"; +import { GenerationData } from "../../../models/eft/common/tables/IBotType"; import { IBaseConfig } from "./IBaseConfig"; export interface IPlayerScavConfig extends IBaseConfig { kind: "aki-playerscav"; @@ -16,10 +16,10 @@ export interface Modifiers { mod: Record; } export interface ItemLimits { - healing: MinMax; - drugs: MinMax; - stims: MinMax; - looseLoot: MinMax; - magazines: MinMax; - grenades: MinMax; + healing: GenerationData; + drugs: GenerationData; + stims: GenerationData; + looseLoot: GenerationData; + magazines: GenerationData; + grenades: GenerationData; } diff --git a/types/models/spt/config/IPmcConfig.d.ts b/types/models/spt/config/IPmcConfig.d.ts index fbf0a44..0f74620 100644 --- a/types/models/spt/config/IPmcConfig.d.ts +++ b/types/models/spt/config/IPmcConfig.d.ts @@ -1,6 +1,8 @@ import { MemberCategory } from "../../../models/enums/MemberCategory"; import { MinMax } from "../../common/MinMax"; -export interface IPmcConfig { +import { IBaseConfig } from "./IBaseConfig"; +export interface IPmcConfig extends IBaseConfig { + kind: "aki-pmc"; /** What game version should the PMC have */ gameVersionWeight: Record; /** What account type should the PMC have */ @@ -18,6 +20,8 @@ export interface IPmcConfig { difficulty: string; /** Chance out of 100 to have a complete gun in backpack */ looseWeaponInBackpackChancePercent: number; + /** Chance out of 100 to have an enhancement applied to PMC weapon */ + weaponHasEnhancementChancePercent: number; /** MinMax count of weapons to have in backpack */ looseWeaponInBackpackLootMinMax: MinMax; /** Percentage chance PMC will be USEC */ @@ -38,6 +42,10 @@ export interface IPmcConfig { enemyTypes: string[]; /** How many levels above player level can a PMC be */ botRelativeLevelDeltaMax: number; + /** Force a number of healing items into PMCs secure container to ensure they can heal */ + forceHealingItemsIntoSecure: boolean; + addPrefixToSameNamePMCAsPlayerChance: number; + allPMCsHavePlayerNameWithRandomPrefixChance: number; } export interface PmcTypes { usec: string; diff --git a/types/models/spt/config/IRagfairConfig.d.ts b/types/models/spt/config/IRagfairConfig.d.ts index bf3d9d8..7aea24f 100644 --- a/types/models/spt/config/IRagfairConfig.d.ts +++ b/types/models/spt/config/IRagfairConfig.d.ts @@ -41,7 +41,8 @@ export interface Dynamic { /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; /** Barter offer specific settings */ - barter: Barter; + barter: IBarterDetails; + pack: IPackDetails; /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; /** How many offers should expire before an offer regeneration occurs */ @@ -49,9 +50,7 @@ export interface Dynamic { /** How many offers should be listed */ offerItemCount: MinMax; /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - price: MinMax; - /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - presetPrice: MinMax; + priceRanges: IPriceRanges; /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; @@ -71,8 +70,15 @@ export interface Dynamic { removeSeasonalItemsWhenNotInEvent: boolean; /** Flea blacklist settings */ blacklist: Blacklist; + /** Dict of price limits keyed by item type */ + unreasonableModPrices: Record; } -export interface Barter { +export interface IPriceRanges { + default: MinMax; + preset: MinMax; + pack: MinMax; +} +export interface IBarterDetails { /** Should barter offers be generated */ enable: boolean; /** Percentage change an offer is listed as a barter */ @@ -88,6 +94,18 @@ export interface Barter { /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } +export interface IPackDetails { + /** Should pack offers be generated */ + enable: boolean; + /** Percentage change an offer is listed as a pack */ + chancePercent: number; + /** Min number of required items for a pack */ + itemCountMin: number; + /** Max number of required items for a pack */ + itemCountMax: number; + /** item types to allow being a pack */ + itemTypeWhitelist: string[]; +} export interface OfferAdjustment { /** Shuld offer price be adjusted when below handbook price */ adjustPriceWhenBelowHandbookPrice: boolean; @@ -114,3 +132,8 @@ export interface Blacklist { /** Should trader items that are blacklisted by bsg */ traderItems: boolean; } +export interface IUnreasonableModPrices { + enabled: boolean; + handbookPriceOverMultiplier: number; + newPriceHandbookMultiplier: number; +} diff --git a/types/models/spt/config/IScavCaseConfig.d.ts b/types/models/spt/config/IScavCaseConfig.d.ts index df5dae0..86a8df3 100644 --- a/types/models/spt/config/IScavCaseConfig.d.ts +++ b/types/models/spt/config/IScavCaseConfig.d.ts @@ -7,6 +7,8 @@ export interface IScavCaseConfig extends IBaseConfig { ammoRewards: AmmoRewards; rewardItemParentBlacklist: string[]; rewardItemBlacklist: string[]; + allowMultipleMoneyRewardsPerRarity: boolean; + allowMultipleAmmoRewardsPerRarity: boolean; } export interface MoneyRewards { moneyRewardChancePercent: number; diff --git a/types/models/spt/config/ITraderConfig.d.ts b/types/models/spt/config/ITraderConfig.d.ts index be6ab91..85adf73 100644 --- a/types/models/spt/config/ITraderConfig.d.ts +++ b/types/models/spt/config/ITraderConfig.d.ts @@ -28,6 +28,10 @@ export interface FenceConfig { itemStackSizeOverrideMinMax: Record; itemTypeLimits: Record; regenerateAssortsOnRefresh: boolean; + /** Max rouble price before item is not listed on flea */ + itemCategoryRoublePriceLimit: Record; + /** Each slotid with % to be removed prior to listing on fence */ + presetSlotsToRemoveChancePercent: Record; /** Block seasonal items from appearing when season is inactive */ blacklistSeasonalItems: boolean; blacklist: string[]; diff --git a/types/models/spt/config/IWeatherConfig.d.ts b/types/models/spt/config/IWeatherConfig.d.ts index 41a1c83..6ecf35b 100644 --- a/types/models/spt/config/IWeatherConfig.d.ts +++ b/types/models/spt/config/IWeatherConfig.d.ts @@ -7,7 +7,7 @@ export interface IWeatherConfig extends IBaseConfig { weather: Weather; } export interface Weather { - clouds: MinMax; + clouds: WeatherSettings; windSpeed: WeatherSettings; windDirection: WeatherSettings; windGustiness: MinMax; diff --git a/types/models/spt/server/IDatabaseTables.d.ts b/types/models/spt/server/IDatabaseTables.d.ts index 582d9e2..66f9afb 100644 --- a/types/models/spt/server/IDatabaseTables.d.ts +++ b/types/models/spt/server/IDatabaseTables.d.ts @@ -1,4 +1,5 @@ import { IQteData } from "../../../models/eft/hideout/IQteData"; +import { IEquipmentBuild } from "../../../models/eft/profile/IAkiProfile"; import { IGlobals } from "../../eft/common/IGlobals"; import { IBotBase } from "../../eft/common/tables/IBotBase"; import { IBotCore } from "../../eft/common/tables/IBotCore"; @@ -48,6 +49,8 @@ export interface IDatabaseTables { profiles: IProfileTemplates; /** Flea prices of items - gathered from online flea market dump */ prices: Record; + /** Default equipment loadouts that show on main inventory screen */ + defaultEquipmentPresets: IEquipmentBuild[]; }; traders?: Record; globals?: IGlobals; diff --git a/types/routers/EventOutputHolder.d.ts b/types/routers/EventOutputHolder.d.ts index 9a34219..1966741 100644 --- a/types/routers/EventOutputHolder.d.ts +++ b/types/routers/EventOutputHolder.d.ts @@ -1,6 +1,6 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { IHideoutImprovement, Productive } from "../models/eft/common/tables/IBotBase"; +import { IHideoutImprovement, Productive, TraderData, TraderInfo } from "../models/eft/common/tables/IBotBase"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -26,6 +26,12 @@ export declare class EventOutputHolder { * @param sessionId Session id */ updateOutputProperties(sessionId: string): void; + /** + * Convert the internal trader data object into an object we can send to the client + * @param traderData server data for traders + * @returns + */ + protected constructTraderRelations(traderData: Record): Record; /** * Return all hideout Improvements from player profile, adjust completed Improvements' completed property to be true * @param pmcData Player profile @@ -33,7 +39,7 @@ export declare class EventOutputHolder { */ protected getImprovementsFromProfileAndFlagComplete(pmcData: IPmcData): Record; /** - * Return productions from player profile except those completed crafts the client has already seen + * Return productions from player profile except those completed crafts the client has already seen * @param pmcData Player profile * @returns dictionary of hideout productions */ diff --git a/types/routers/serializers/NotifySerializer.d.ts b/types/routers/serializers/NotifySerializer.d.ts index 0d8cc89..1d179b2 100644 --- a/types/routers/serializers/NotifySerializer.d.ts +++ b/types/routers/serializers/NotifySerializer.d.ts @@ -3,10 +3,12 @@ import { IncomingMessage, ServerResponse } from "http"; import { NotifierController } from "../../controllers/NotifierController"; import { Serializer } from "../../di/Serializer"; import { HttpServerHelper } from "../../helpers/HttpServerHelper"; +import { JsonUtil } from "../../utils/JsonUtil"; export declare class NotifySerializer extends Serializer { protected notifierController: NotifierController; + protected jsonUtil: JsonUtil; protected httpServerHelper: HttpServerHelper; - constructor(notifierController: NotifierController, httpServerHelper: HttpServerHelper); + constructor(notifierController: NotifierController, jsonUtil: JsonUtil, httpServerHelper: HttpServerHelper); serialize(_sessionID: string, req: IncomingMessage, resp: ServerResponse, _: any): void; canHandle(route: string): boolean; } diff --git a/types/servers/ConfigServer.d.ts b/types/servers/ConfigServer.d.ts index a079be8..f01be24 100644 --- a/types/servers/ConfigServer.d.ts +++ b/types/servers/ConfigServer.d.ts @@ -1,12 +1,13 @@ import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; -import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigTypes } from "../models/enums/ConfigTypes"; +import { ILogger } from "../models/spt/utils/ILogger"; export declare class ConfigServer { protected logger: ILogger; protected vfs: VFS; protected jsonUtil: JsonUtil; protected configs: Record; + protected readonly acceptableFileExtensions: string[]; constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil); getConfig(configType: ConfigTypes): T; getConfigByString(configType: string): T; diff --git a/types/servers/WebSocketServer.d.ts b/types/servers/WebSocketServer.d.ts index 5d40e6e..fffbea2 100644 --- a/types/servers/WebSocketServer.d.ts +++ b/types/servers/WebSocketServer.d.ts @@ -6,6 +6,7 @@ import { INotification } from "../models/eft/notifier/INotifier"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ConfigServer } from "./ConfigServer"; export declare class WebSocketServer { @@ -13,8 +14,9 @@ export declare class WebSocketServer { protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected localisationService: LocalisationService; + protected jsonUtil: JsonUtil; protected httpServerHelper: HttpServerHelper; - constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, localisationService: LocalisationService, httpServerHelper: HttpServerHelper); + constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, localisationService: LocalisationService, jsonUtil: JsonUtil, httpServerHelper: HttpServerHelper); protected httpConfig: IHttpConfig; protected defaultNotification: INotification; protected webSockets: Record; diff --git a/types/services/BotEquipmentFilterService.d.ts b/types/services/BotEquipmentFilterService.d.ts index eb21fd8..d50c52d 100644 --- a/types/services/BotEquipmentFilterService.d.ts +++ b/types/services/BotEquipmentFilterService.d.ts @@ -1,5 +1,6 @@ import { BotHelper } from "../helpers/BotHelper"; -import { EquipmentChances, Generation, IBotType, MinMaxWithWhitelist, ModsChances } from "../models/eft/common/tables/IBotType"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { EquipmentChances, Generation, GenerationData, 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"; @@ -7,21 +8,23 @@ import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; protected botHelper: BotHelper; + protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected botEquipmentConfig: Record; - constructor(logger: ILogger, botHelper: BotHelper, configServer: ConfigServer); + constructor(logger: ILogger, botHelper: BotHelper, profileHelper: ProfileHelper, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig + * @param sessionId Players id * @param baseBotNode bots json data to filter * @param botLevel Level of the bot * @param botGenerationDetails details on how to generate a bot */ - filterBotEquipment(baseBotNode: IBotType, botLevel: number, botGenerationDetails: BotGenerationDetails): void; + filterBotEquipment(sessionId: string, baseBotNode: IBotType, botLevel: number, botGenerationDetails: BotGenerationDetails): void; /** - * Iterate over the changes passed in and alter data in baseValues + * Iterate over the changes passed in and apply them to baseValues parameter * @param equipmentChanges Changes to apply - * @param baseValues Values to update + * @param baseValues data to update */ protected adjustChances(equipmentChanges: Record, baseValues: EquipmentChances | ModsChances): void; /** @@ -29,7 +32,7 @@ export declare class BotEquipmentFilterService { * @param generationChanges Changes to apply * @param baseBotGeneration dictionary to update */ - protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; + protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; /** * Get equipment settings for bot * @param botEquipmentRole equipment role to return @@ -57,19 +60,19 @@ export declare class BotEquipmentFilterService { */ protected getBotEquipmentWhitelist(botRole: string, playerLevel: number): EquipmentFilterDetails; /** - * Retrieve clothing weighting adjustments from bot.json config + * Retrieve item weighting adjustments from bot.json config based on bot level * @param botRole Bot type to get adjustments for - * @param playerLevel level of player - * @returns Weighting adjustments for bots clothing - */ - protected getBotClothingAdjustments(botRole: string, playerLevel: number): WeightingAdjustmentDetails; - /** - * Retrieve item weighting adjustments from bot.json config - * @param botRole Bot type to get adjustments for - * @param playerLevel level of player + * @param botLevel Level of bot * @returns Weighting adjustments for bot items */ - protected getBotWeightingAdjustments(botRole: string, playerLevel: number): WeightingAdjustmentDetails; + protected getBotWeightingAdjustments(botRole: string, botLevel: number): WeightingAdjustmentDetails; + /** + * Retrieve item weighting adjustments from bot.json config based on player level + * @param botRole Bot type to get adjustments for + * @param playerlevel Level of bot + * @returns Weighting adjustments for bot items + */ + protected getBotWeightingAdjustmentsByPlayerLevel(botRole: string, playerlevel: number): WeightingAdjustmentDetails; /** * Filter bot equipment based on blacklist and whitelist from config/bot.json * Prioritizes whitelist first, if one is found blacklist is ignored diff --git a/types/services/FenceService.d.ts b/types/services/FenceService.d.ts index 3f0e01b..dfd8820 100644 --- a/types/services/FenceService.d.ts +++ b/types/services/FenceService.d.ts @@ -44,12 +44,12 @@ export declare class FenceService { * Replace main fence assort with new assort * @param assort New assorts to replace old with */ - protected setFenceAssort(assort: ITraderAssort): void; + setFenceAssort(assort: ITraderAssort): void; /** * Replace high rep level fence assort with new assort * @param assort New assorts to replace old with */ - protected setFenceDiscountAssort(assort: ITraderAssort): void; + setFenceDiscountAssort(assort: ITraderAssort): void; /** * Get assorts player can purchase * Adjust prices based on fence level of player @@ -153,6 +153,18 @@ export declare class FenceService { * @param loyaltyLevel loyalty level to requre item at */ protected addPresets(desiredPresetCount: number, defaultWeaponPresets: Record, assorts: ITraderAssort, loyaltyLevel: number): void; + /** + * Remove parts of a weapon prior to being listed on flea + * @param weaponAndMods Weapon to remove parts from + */ + protected removeRandomPartsOfWeapon(weaponAndMods: Item[]): void; + /** + * Roll % chance check to see if item should be removed + * @param weaponMod Weapon mod being checked + * @param itemsBeingDeleted Current list of items on weapon being deleted + * @returns True if item will be removed + */ + protected presetModItemWillBeRemoved(weaponMod: Item, itemsBeingDeleted: string[]): boolean; /** * Randomise items' upd properties e.g. med packs/weapons/armor * @param itemDetails Item being randomised diff --git a/types/services/HashCacheService.d.ts b/types/services/HashCacheService.d.ts index 5320f28..9968478 100644 --- a/types/services/HashCacheService.d.ts +++ b/types/services/HashCacheService.d.ts @@ -11,7 +11,18 @@ export declare class HashCacheService { protected modHashes: any; protected readonly modCachePath = "./user/cache/modCache.json"; constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + /** + * Return a stored hash by key + * @param modName Name of mod to get hash for + * @returns Mod hash + */ getStoredModHash(modName: string): string; + /** + * Does the generated hash match the stored hash + * @param modName name of mod + * @param modContent + * @returns True if they match + */ modContentMatchesStoredHash(modName: string, modContent: string): boolean; hashMatchesStoredHash(modName: string, modHash: string): boolean; storeModContent(modName: string, modContent: string): void; diff --git a/types/services/InsuranceService.d.ts b/types/services/InsuranceService.d.ts index 1d30f6d..69bf0e4 100644 --- a/types/services/InsuranceService.d.ts +++ b/types/services/InsuranceService.d.ts @@ -2,28 +2,30 @@ import { ITraderBase } from "../models/eft/common/tables/ITrader"; import { DialogueHelper } from "../helpers/DialogueHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; -import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { InsuredItem } from "../models/eft/common/tables/IBotBase"; import { Item } from "../models/eft/common/tables/IItem"; +import { IInsuredItemsData } from "../models/eft/inRaid/IInsuredItemsData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { LocaleService } from "./LocaleService"; import { LocalisationService } from "./LocalisationService"; +import { MailSendService } from "./MailSendService"; export declare class InsuranceService { protected logger: ILogger; protected databaseServer: DatabaseServer; protected secureContainerHelper: SecureContainerHelper; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; protected saveServer: SaveServer; protected traderHelper: TraderHelper; @@ -31,11 +33,16 @@ export declare class InsuranceService { protected handbookHelper: HandbookHelper; protected localisationService: LocalisationService; protected localeService: LocaleService; - protected notificationSendHelper: NotificationSendHelper; + protected mailSendService: MailSendService; protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, mailSendService: MailSendService, configServer: ConfigServer); + /** + * Does player have insurance array + * @param sessionId Player id + * @returns True if exists + */ insuranceExists(sessionId: string): boolean; /** * Get all insured items by all traders for a profile @@ -60,9 +67,10 @@ export declare class InsuranceService { sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void; /** * Send a message to player informing them gear was lost - * @param sessionID Session id + * @param sessionId Session id + * @param locationName name of map insurance was lost on */ - sendLostInsuranceMessage(sessionID: string): void; + sendLostInsuranceMessage(sessionId: string, locationName?: string): void; /** * Check all root insured items and remove location property + set slotId to 'hideout' * @param sessionId Session id @@ -78,7 +86,7 @@ export declare class InsuranceService { */ protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; /** - * Store lost gear post-raid inside profile + * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it * @param pmcData player profile to store gear in * @param offraidData post-raid request object * @param preRaidGear gear player wore prior to raid @@ -86,6 +94,21 @@ export declare class InsuranceService { * @param playerDied did the player die in raid */ storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; + /** + * Take preraid item and update properties to ensure its ready to be given to player in insurance return mail + * @param pmcData Player profile + * @param insuredItem Insured items properties + * @param preRaidItem Insured item as it was pre-raid + * @param insuredItemFromClient Item data when player left raid (durability values) + * @returns Item object + */ + protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item; + /** + * Reset slotId property to "hideout" when necessary (used to be in ) + * @param pmcData Players pmcData.Inventory.equipment value + * @param itemToReturn item we will send to player as insurance return + */ + protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void; /** * Create a hash table for an array of items, keyed by items _id * @param items Items to hash @@ -94,12 +117,17 @@ export declare class InsuranceService { protected createItemHashTable(items: Item[]): Record; /** * Add gear item to InsuredItems array in player profile - * @param pmcData profile to store item in - * @param insuredItem Item to store in profile - * @param actualItem item to store * @param sessionID Session id + * @param pmcData Player profile + * @param itemToReturnToPlayer item to store + * @param traderId Id of trader item was insured with */ - protected addGearToSend(pmcData: IPmcData, insuredItem: InsuredItem, actualItem: Item, sessionID: string): void; + protected addGearToSend(gear: { + sessionID: string; + pmcData: IPmcData; + itemToReturnToPlayer: Item; + traderId: string; + }): void; /** * Does insurance exist for a player and by trader * @param sessionId Player id (session id) diff --git a/types/services/LocalisationService.d.ts b/types/services/LocalisationService.d.ts index 44a4941..ec6eecf 100644 --- a/types/services/LocalisationService.d.ts +++ b/types/services/LocalisationService.d.ts @@ -2,17 +2,19 @@ import { I18n } from "i18n"; import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { RandomUtil } from "../utils/RandomUtil"; import { LocaleService } from "./LocaleService"; /** * Handles translating server text into different langauges */ export declare class LocalisationService { protected logger: ILogger; + protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected localeConfig: ILocaleConfig; protected i18n: I18n; - constructor(logger: ILogger, databaseServer: DatabaseServer, localeService: LocaleService); + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** * Get a localised value using the passed in key * @param key Key to loop up locale for @@ -25,4 +27,10 @@ export declare class LocalisationService { * @returns string array of keys */ getKeys(): string[]; + /** + * From the provided partial key, find all keys that start with text and choose a random match + * @param partialKey Key to match locale keys on + * @returns locale text + */ + getRandomTextThatMatchesPartialKey(partialKey: string): string; } diff --git a/types/services/MailSendService.d.ts b/types/services/MailSendService.d.ts index 70b8e44..1d49638 100644 --- a/types/services/MailSendService.d.ts +++ b/types/services/MailSendService.d.ts @@ -1,6 +1,8 @@ +import { DialogueHelper } from "../helpers/DialogueHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { NotifierHelper } from "../helpers/NotifierHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { Item } from "../models/eft/common/tables/IItem"; import { Dialogue, IUserDialogInfo, Message, MessageItems } from "../models/eft/profile/IAkiProfile"; import { MessageType } from "../models/enums/MessageType"; @@ -19,51 +21,61 @@ export declare class MailSendService { protected saveServer: SaveServer; protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; + protected dialogueHelper: DialogueHelper; protected notificationSendHelper: NotificationSendHelper; protected localisationService: LocalisationService; protected itemHelper: ItemHelper; + protected traderHelper: TraderHelper; protected readonly systemSenderId = "59e7125688a45068a6249071"; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, dialogueHelper: DialogueHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper, traderHelper: TraderHelper); /** * Send a message from an NPC (e.g. prapor) to the player with or without items using direct message text, do not look up any locale - * @param playerId Players id to send message to - * @param sender The trader sending the message + * @param sessionId The session ID to send the message to + * @param trader The trader sending the message * @param messageType What type the message will assume (e.g. QUEST_SUCCESS) * @param message Text to send to the player * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendDirectNpcMessageToPlayer(sessionId: string, trader: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from an NPC (e.g. prapor) to the player with or without items - * @param playerId Players id to send message to - * @param sender The trader sending the message + * @param sessionId The session ID to send the message to + * @param trader The trader sending the message * @param messageType What type the message will assume (e.g. QUEST_SUCCESS) * @param messageLocaleId The localised text to send to player * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendLocalisedNpcMessageToPlayer(sessionId: string, trader: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from SYSTEM to the player with or without items - * @param playerId Players id to send message to + * @param sessionId The session ID to send the message to * @param message The text to send to player * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendSystemMessageToPlayer(playerId: string, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendSystemMessageToPlayer(sessionId: string, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + /** + * Send a message from SYSTEM to the player with or without items with localised text + * @param sessionId The session ID to send the message to + * @param messageLocaleId Id of key from locale file to send to player + * @param items Optional items to send to player + * @param maxStorageTimeSeconds Optional time to collect items before they expire + */ + sendLocalisedSystemMessageToPlayer(sessionId: string, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any): void; /** * Send a USER message to a player with or without items - * @param playerId Players id to send message to + * @param sessionId The session ID to send the message to * @param senderId Who is sending the message * @param message The text to send to player * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendUserMessageToPlayer(playerId: string, senderDetails: IUserDialogInfo, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendUserMessageToPlayer(sessionId: string, senderDetails: IUserDialogInfo, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; /** * Large function to send messages to players from a variety of sources (SYSTEM/NPC/USER) - * Helper functions in this class are availble to simplify common actions + * Helper functions in this class are available to simplify common actions * @param messageDetails Details needed to send a message to the player */ sendMessageToPlayer(messageDetails: ISendMessageDetails): void; @@ -95,6 +107,12 @@ export declare class MailSendService { * @returns Sanitised items */ protected processItemsBeforeAddingToMail(dialogType: MessageType, messageDetails: ISendMessageDetails): MessageItems; + /** + * Try to find the most correct item to be the 'primary' item in a reward mail + * @param items Possible items to choose from + * @returns Chosen 'primary' item + */ + protected getBaseItemFromRewards(items: Item[]): Item; /** * Get a dialog with a specified entity (user/trader) * Create and store empty dialog if none exists in profile diff --git a/types/services/MatchBotDetailsCacheService.d.ts b/types/services/MatchBotDetailsCacheService.d.ts index eb365dd..c1bd322 100644 --- a/types/services/MatchBotDetailsCacheService.d.ts +++ b/types/services/MatchBotDetailsCacheService.d.ts @@ -1,7 +1,7 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { LocalisationService } from "./LocalisationService"; -/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt ideal as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ export declare class MatchBotDetailsCacheService { protected logger: ILogger; protected localisationService: LocalisationService; @@ -17,9 +17,9 @@ export declare class MatchBotDetailsCacheService { */ clearCache(): void; /** - * Find a bot in the cache by its name + * Find a bot in the cache by its name and side * @param botName Name of bot to find * @returns Bot details */ - getBotByName(botName: string): IBotBase; + getBotByNameAndSide(botName: string, botSide: string): IBotBase; } diff --git a/types/services/ModCompilerService.d.ts b/types/services/ModCompilerService.d.ts index a4bf3c8..52d4e26 100644 --- a/types/services/ModCompilerService.d.ts +++ b/types/services/ModCompilerService.d.ts @@ -1,14 +1,37 @@ import { CompilerOptions } from "typescript"; import type { ILogger } from "../models/spt/utils/ILogger"; -import { HashCacheService } from "./HashCacheService"; import { VFS } from "../utils/VFS"; +import { HashCacheService } from "./HashCacheService"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; + protected serverDependencies: string[]; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + /** + * Convert a mods TS into JS + * @param modName Name of mod + * @param modPath Dir path to mod + * @param modTypeScriptFiles + * @returns + */ compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; + /** + * Convert a TS file into JS + * @param fileNames Paths to TS files + * @param options Compiler options + */ protected compile(fileNames: string[], options: CompilerOptions): Promise; + /** + * Do the files at the provided paths exist + * @param fileNames + * @returns + */ protected areFilesReady(fileNames: string[]): boolean; + /** + * Wait the provided number of milliseconds + * @param ms Milliseconds + * @returns + */ protected delay(ms: number): Promise; } diff --git a/types/services/PaymentService.d.ts b/types/services/PaymentService.d.ts index 1c9c32b..a604956 100644 --- a/types/services/PaymentService.d.ts +++ b/types/services/PaymentService.d.ts @@ -28,9 +28,16 @@ export declare class PaymentService { * @param {IPmcData} pmcData Player profile * @param {IProcessBuyTradeRequestData} request * @param {string} sessionID - * @returns Object + * @returns IItemEventRouterResponse */ payMoney(pmcData: IPmcData, request: IProcessBuyTradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Get the item price of a specific traders assort + * @param traderAssortId Id of assort to look up + * @param traderId Id of trader with assort + * @returns Handbook rouble price of item + */ + protected getTraderItemHandbookPriceRouble(traderAssortId: string, traderId: string): number; /** * Receive money back after selling * @param {IPmcData} pmcData @@ -61,23 +68,26 @@ export declare class PaymentService { * Get all money stacks in inventory and prioritse items in stash * @param pmcData * @param currencyTpl + * @param playerStashId Players stash id * @returns Sorting money items */ - protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string, playerStashId: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container * @param a First money stack item * @param b Second money stack item * @param inventoryItems players inventory items + * @param playerStashId Players stash id * @returns sort order */ - protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[]): number; + protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[], playerStashId: string): number; /** * Recursivly check items parents to see if it is inside the players inventory, not stash * @param itemId item id to check * @param inventoryItems player inventory + * @param playerStashId Players stash id * @returns true if its in inventory */ - protected isInInventory(itemId: string, inventoryItems: Item[]): boolean; + protected isInStash(itemId: string, inventoryItems: Item[], playerStashId: string): boolean; } diff --git a/types/services/ProfileFixerService.d.ts b/types/services/ProfileFixerService.d.ts index 235499c..bc1e42e 100644 --- a/types/services/ProfileFixerService.d.ts +++ b/types/services/ProfileFixerService.d.ts @@ -1,5 +1,8 @@ import { HideoutHelper } from "../helpers/HideoutHelper"; import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Bonus, HideoutSlot } from "../models/eft/common/tables/IBotBase"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; @@ -7,9 +10,11 @@ import { StageBonus } from "../models/eft/hideout/IHideoutArea"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; +import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { LocalisationService } from "./LocalisationService"; @@ -18,17 +23,27 @@ export declare class ProfileFixerService { protected watermark: Watermark; protected hideoutHelper: HideoutHelper; protected inventoryHelper: InventoryHelper; + protected traderHelper: TraderHelper; + protected profileHelper: ProfileHelper; + protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected timeUtil: TimeUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, timeUtil: TimeUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + protected ragfairConfig: IRagfairConfig; + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix */ checkForAndFixPmcProfileIssues(pmcProfile: IPmcData): void; + protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; + protected addHideoutAreaStashes(pmcProfile: IPmcData): void; + protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; + protected adjustUnreasonableModFleaPrices(): void; /** * Add tag to profile to indicate when it was made * @param fullProfile @@ -54,7 +69,6 @@ export declare class ProfileFixerService { */ protected updateProfileQuestDataValues(pmcProfile: IPmcData): void; protected addMissingRepeatableQuestsProperty(pmcProfile: IPmcData): void; - protected addMissingWorkbenchWeaponSkills(pmcProfile: IPmcData): void; /** * Some profiles have hideout maxed and therefore no improvements * @param pmcProfile Profile to add improvement data to @@ -82,7 +96,6 @@ export declare class ProfileFixerService { * @param pmcProfile */ protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; - addMissingArmorRepairSkill(pmcProfile: IPmcData): void; /** * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing * @param pmcProfile Profile to update @@ -100,7 +113,7 @@ export declare class ProfileFixerService { * @param sessionId Session id * @param pmcProfile Profile to check inventory of */ - checkForOrphanedModdedItems(sessionId: string, pmcProfile: IPmcData): void; + checkForOrphanedModdedItems(sessionId: string, fullProfile: IAkiProfile): void; /** * Add `Improvements` object to hideout if missing - added in eft 13.0.21469 * @param pmcProfile profile to update @@ -116,4 +129,14 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to update */ removeLegacyScavCaseProductionCrafts(pmcProfile: IPmcData): void; + /** + * 26126 (7th August) requires bonuses to have an ID, these were not included in the default profile presets + * @param pmcProfile Profile to add missing IDs to + */ + addMissingIdsToBonuses(pmcProfile: IPmcData): void; + /** + * At some point the property name was changed,migrate data across to new name + * @param pmcProfile + */ + protected migrateImprovements(pmcProfile: IPmcData): void; } diff --git a/types/services/RagfairPriceService.d.ts b/types/services/RagfairPriceService.d.ts index e245efa..ff35327 100644 --- a/types/services/RagfairPriceService.d.ts +++ b/types/services/RagfairPriceService.d.ts @@ -3,6 +3,7 @@ import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { MinMax } from "../models/common/MinMax"; import { IPreset } from "../models/eft/common/IGlobals"; import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; @@ -35,10 +36,6 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; - /** - * Add placeholder values for items missing from handbook - */ - protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache @@ -91,9 +88,17 @@ export declare class RagfairPriceService implements OnLoad { * Generate a currency cost for an item and its mods * @param items Item with mods to get price for * @param desiredCurrency Currency price desired in + * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; + getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * Get different min/max price multipliers for different offer types (preset/pack/default) + * @param isPreset Offer is a preset + * @param isPack Offer is a pack + * @returns MinMax values + */ + protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json * @param itemPrice price of item @@ -104,10 +109,10 @@ export declare class RagfairPriceService implements OnLoad { /** * Multiply the price by a randomised curve where n = 2, shift = 2 * @param existingPrice price to alter - * @param isPreset is the item we're multiplying a preset + * @param rangeValues min and max to adjust price by * @returns multiplied price */ - protected randomisePrice(existingPrice: number, isPreset: boolean): number; + protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset * @param item base weapon diff --git a/types/helpers/RagfairTaxHelper.d.ts b/types/services/RagfairTaxService.d.ts similarity index 63% rename from types/helpers/RagfairTaxHelper.d.ts rename to types/services/RagfairTaxService.d.ts index 5ba2917..e6b3d7c 100644 --- a/types/helpers/RagfairTaxHelper.d.ts +++ b/types/services/RagfairTaxService.d.ts @@ -1,16 +1,21 @@ +import { ItemHelper } from "../helpers/ItemHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IStorePlayerOfferTaxAmountRequestData } from "../models/eft/ragfair/IStorePlayerOfferTaxAmountRequestData"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RagfairPriceService } from "../services/RagfairPriceService"; -import { ItemHelper } from "./ItemHelper"; -export declare class RagfairTaxHelper { +export declare class RagfairTaxService { protected logger: ILogger; protected databaseServer: DatabaseServer; protected ragfairPriceService: RagfairPriceService; protected itemHelper: ItemHelper; + protected playerOfferTaxCache: Record; constructor(logger: ILogger, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemHelper: ItemHelper); + storeClientOfferTaxValue(sessionId: string, offer: IStorePlayerOfferTaxAmountRequestData): void; + clearStoredOfferTaxById(offerIdToRemove: string): void; + getStoredClientOfferTaxValueById(offerIdToGet: string): IStorePlayerOfferTaxAmountRequestData; calculateTax(item: Item, pmcData: IPmcData, requirementsValue: number, offerItemCount: number, sellInOnePiece: boolean): number; protected calculateItemWorth(item: Item, itemTemplate: ITemplateItem, itemCount: number, pmcData: IPmcData, isRootItem?: boolean): number; } diff --git a/types/services/RepairService.d.ts b/types/services/RepairService.d.ts index 2f7d1db..2fd22ed 100644 --- a/types/services/RepairService.d.ts +++ b/types/services/RepairService.d.ts @@ -94,11 +94,11 @@ export declare class RepairService { */ addBuffToItem(repairDetails: RepairDetails, pmcData: IPmcData): void; /** - * Add buff to item + * Add random buff to item * @param itemConfig weapon/armor config * @param repairDetails Details for item to repair */ - protected addBuff(itemConfig: BonusSettings, repairDetails: RepairDetails): void; + addBuff(itemConfig: BonusSettings, item: Item): void; /** * Check if item should be buffed by checking the item type and relevant player skill level * @param repairDetails Item that was repaired diff --git a/types/utils/App.d.ts b/types/utils/App.d.ts index b947c83..dd8f24c 100644 --- a/types/utils/App.d.ts +++ b/types/utils/App.d.ts @@ -2,15 +2,18 @@ import { OnLoad } from "../di/OnLoad"; import { OnUpdate } from "../di/OnUpdate"; import { ILogger } from "../models/spt/utils/ILogger"; import { LocalisationService } from "../services/LocalisationService"; +import { EncodingUtil } from "./EncodingUtil"; import { TimeUtil } from "./TimeUtil"; export declare class App { protected logger: ILogger; protected timeUtil: TimeUtil; protected localisationService: LocalisationService; + protected encodingUtil: EncodingUtil; protected onLoadComponents: OnLoad[]; protected onUpdateComponents: OnUpdate[]; protected onUpdateLastRun: {}; - constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); + protected os: any; + constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, encodingUtil: EncodingUtil, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); load(): Promise; protected update(onUpdateComponents: OnUpdate[]): Promise; protected logUpdateException(err: any, updateable: OnUpdate): void; diff --git a/types/utils/HashUtil.d.ts b/types/utils/HashUtil.d.ts index a8500e1..c017ca8 100644 --- a/types/utils/HashUtil.d.ts +++ b/types/utils/HashUtil.d.ts @@ -18,4 +18,5 @@ export declare class HashUtil { * @returns hash value */ generateHashForData(algorithm: string, data: crypto.BinaryLike): string; + generateAccountId(): number; } diff --git a/types/utils/HttpResponseUtil.d.ts b/types/utils/HttpResponseUtil.d.ts index 3a78618..70282ab 100644 --- a/types/utils/HttpResponseUtil.d.ts +++ b/types/utils/HttpResponseUtil.d.ts @@ -9,6 +9,11 @@ export declare class HttpResponseUtil { protected localisationService: LocalisationService; constructor(jsonUtil: JsonUtil, localisationService: LocalisationService); protected clearString(s: string): any; + /** + * Return passed in data as JSON string + * @param data + * @returns + */ noBody(data: any): any; getBody(data: T, err?: number, errmsg?: any): IGetBodyResponseData; getUnclearedBody(data: any, err?: number, errmsg?: any): string; diff --git a/types/utils/JsonUtil.d.ts b/types/utils/JsonUtil.d.ts index 229dc26..30cf2ac 100644 --- a/types/utils/JsonUtil.d.ts +++ b/types/utils/JsonUtil.d.ts @@ -1,3 +1,4 @@ +import { IParseOptions, IStringifyOptions, Reviver } from "jsonc/lib/interfaces"; import { ILogger } from "../models/spt/utils/ILogger"; import { HashUtil } from "./HashUtil"; import { VFS } from "./VFS"; @@ -7,21 +8,70 @@ export declare class JsonUtil { protected logger: ILogger; protected fileHashes: any; protected jsonCacheExists: boolean; + protected jsonCachePath: string; constructor(vfs: VFS, hashUtil: HashUtil, logger: ILogger); /** * From object to string * @param data object to turn into JSON - * @param prettify Should output be prettified? + * @param prettify Should output be prettified * @returns string */ - serialize(data: T, prettify?: boolean): string; + serialize(data: any, prettify?: boolean): string; + /** + * From object to string + * @param data object to turn into JSON + * @param replacer An array of strings and numbers that acts as an approved list for selecting the object properties that will be stringified. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + * @returns string + */ + serializeAdvanced(data: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string; + /** + * From object to string + * @param data object to turn into JSON + * @param filename Name of file being serialized + * @param options Stringify options or a replacer. + * @returns The string converted from the JavaScript value + */ + serializeJsonC(data: any, filename?: string | null, options?: IStringifyOptions | Reviver): string; + serializeJson5(data: any, filename?: string | null, prettify?: boolean): string; /** * From string to object * @param jsonString json string to turn into object + * @param filename Name of file being deserialized * @returns object */ deserialize(jsonString: string, filename?: string): T; + /** + * From string to object + * @param jsonString json string to turn into object + * @param filename Name of file being deserialized + * @param options Parsing options + * @returns object + */ + deserializeJsonC(jsonString: string, filename?: string, options?: IParseOptions): T; + deserializeJson5(jsonString: string, filename?: string): T; deserializeWithCacheCheckAsync(jsonString: string, filePath: string): Promise; + /** + * From json string to object + * @param jsonString String to turn into object + * @param filePath Path to json file being processed + * @returns Object + */ deserializeWithCacheCheck(jsonString: string, filePath: string): T; - clone(data: T): T; + /** + * Create file if nothing found + * @param jsonCachePath path to cache + */ + protected ensureJsonCacheExists(jsonCachePath: string): void; + /** + * Read contents of json cache and add to class field + * @param jsonCachePath Path to cache + */ + protected hydrateJsonCache(jsonCachePath: string): void; + /** + * Convert into string and back into object to clone object + * @param objectToClone Item to clone + * @returns Cloned parameter + */ + clone(objectToClone: T): T; } diff --git a/types/utils/RandomUtil.d.ts b/types/utils/RandomUtil.d.ts index 806071f..92c37da 100644 --- a/types/utils/RandomUtil.d.ts +++ b/types/utils/RandomUtil.d.ts @@ -18,7 +18,8 @@ import { MathUtil } from "./MathUtil"; */ export declare class ProbabilityObjectArray extends Array> { private mathUtil; - constructor(mathUtil: MathUtil, ...items: ProbabilityObject[]); + private jsonUtil; + constructor(mathUtil: MathUtil, jsonUtil: JsonUtil, ...items: ProbabilityObject[]); filter(callbackfn: (value: ProbabilityObject, index: number, array: ProbabilityObject[]) => any): ProbabilityObjectArray; /** * Calculates the normalized cumulative probability of the ProbabilityObjectArray's elements normalized to 1 @@ -78,11 +79,10 @@ export declare class ProbabilityObjectArray extends Array): K[]; } diff --git a/types/utils/VFS.d.ts b/types/utils/VFS.d.ts index 842150c..2cb09fa 100644 --- a/types/utils/VFS.d.ts +++ b/types/utils/VFS.d.ts @@ -23,6 +23,7 @@ export declare class VFS { }) => Promise; unlinkPromisify: (path: fs.PathLike) => Promise; rmdirPromisify: (path: fs.PathLike) => Promise; + renamePromisify: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise; constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); exists(filepath: fs.PathLike): boolean; existsAsync(filepath: fs.PathLike): Promise; @@ -45,6 +46,8 @@ export declare class VFS { removeFileAsync(filepath: string): Promise; removeDir(filepath: string): void; removeDirAsync(filepath: string): Promise; + rename(oldPath: string, newPath: string): void; + renameAsync(oldPath: string, newPath: string): Promise; protected lockFileSync(filepath: any): void; protected checkFileSync(filepath: any): any; protected unlockFileSync(filepath: any): void;