From a8de8602b309e3eb398f374a7b3d3cfac90759b4 Mon Sep 17 00:00:00 2001 From: Platinum Date: Mon, 9 Oct 2023 20:21:00 +1100 Subject: [PATCH] chore: update types --- types/callbacks/BotCallbacks.d.ts | 1 + types/callbacks/BundleCallbacks.d.ts | 3 + types/callbacks/CustomizationCallbacks.d.ts | 12 +- types/callbacks/DataCallbacks.d.ts | 27 +- types/callbacks/DialogueCallbacks.d.ts | 38 +- types/callbacks/GameCallbacks.d.ts | 17 +- types/callbacks/HideoutCallbacks.d.ts | 14 +- types/callbacks/InraidCallbacks.d.ts | 1 + types/callbacks/InsuranceCallbacks.d.ts | 2 +- types/callbacks/InventoryCallbacks.d.ts | 7 + types/callbacks/LauncherCallbacks.d.ts | 2 + types/callbacks/LocationCallbacks.d.ts | 3 + types/callbacks/MatchCallbacks.d.ts | 14 + types/callbacks/NoteCallbacks.d.ts | 3 + types/callbacks/NotifierCallbacks.d.ts | 7 +- types/callbacks/PresetBuildCallbacks.d.ts | 18 +- types/callbacks/ProfileCallbacks.d.ts | 42 +- types/callbacks/QuestCallbacks.d.ts | 19 +- types/callbacks/RagfairCallbacks.d.ts | 17 +- types/callbacks/RepairCallbacks.d.ts | 22 +- types/callbacks/TradeCallbacks.d.ts | 6 +- types/callbacks/TraderCallbacks.d.ts | 3 + types/callbacks/WishlistCallbacks.d.ts | 2 + types/controllers/BotController.d.ts | 5 +- .../controllers/CustomizationController.d.ts | 11 +- types/controllers/DialogueController.d.ts | 94 +- types/controllers/GameController.d.ts | 75 +- types/controllers/HealthController.d.ts | 33 +- types/controllers/HideoutController.d.ts | 42 +- types/controllers/InraidController.d.ts | 8 +- types/controllers/InsuranceController.d.ts | 139 ++- types/controllers/InventoryController.d.ts | 59 +- types/controllers/LauncherController.d.ts | 20 +- types/controllers/LocationController.d.ts | 32 +- types/controllers/MatchController.d.ts | 16 +- types/controllers/NotifierController.d.ts | 1 + types/controllers/PresetBuildController.d.ts | 28 +- types/controllers/ProfileController.d.ts | 52 +- types/controllers/QuestController.d.ts | 43 +- types/controllers/RagfairController.d.ts | 37 +- types/controllers/RepairController.d.ts | 2 + .../RepeatableQuestController.d.ts | 33 +- types/controllers/TradeController.d.ts | 36 +- types/controllers/TraderController.d.ts | 3 + types/controllers/WeatherController.d.ts | 1 + types/controllers/WishlistController.d.ts | 2 + types/di/Router.d.ts | 4 +- .../generators/BotEquipmentModGenerator.d.ts | 17 +- types/generators/BotGenerator.d.ts | 17 +- types/generators/BotInventoryGenerator.d.ts | 8 +- types/generators/BotLevelGenerator.d.ts | 4 +- types/generators/BotLootGenerator.d.ts | 60 +- types/generators/BotWeaponGenerator.d.ts | 24 +- .../generators/FenceBaseAssortGenerator.d.ts | 4 +- types/generators/LocationGenerator.d.ts | 88 +- types/generators/LootGenerator.d.ts | 50 +- types/generators/PMCLootGenerator.d.ts | 10 +- types/generators/RagfairAssortGenerator.d.ts | 6 +- types/generators/RagfairOfferGenerator.d.ts | 72 +- types/generators/ScavCaseRewardGenerator.d.ts | 13 +- types/generators/WeatherGenerator.d.ts | 8 +- .../generators/weapongen/InventoryMagGen.d.ts | 6 +- types/helpers/AssortHelper.d.ts | 10 +- types/helpers/BotDifficultyHelper.d.ts | 4 +- types/helpers/BotGeneratorHelper.d.ts | 11 +- types/helpers/BotHelper.d.ts | 4 +- types/helpers/BotWeaponGeneratorHelper.d.ts | 17 +- types/helpers/ContainerHelper.d.ts | 32 +- types/helpers/DialogueHelper.d.ts | 22 +- types/helpers/DurabilityLimitsHelper.d.ts | 26 + types/helpers/HandbookHelper.d.ts | 16 +- types/helpers/HealthHelper.d.ts | 5 +- types/helpers/HideoutHelper.d.ts | 60 +- types/helpers/HttpServerHelper.d.ts | 9 + types/helpers/InRaidHelper.d.ts | 42 +- types/helpers/InventoryHelper.d.ts | 79 +- types/helpers/ItemHelper.d.ts | 91 +- types/helpers/NotifierHelper.d.ts | 13 +- types/helpers/PresetHelper.d.ts | 17 +- types/helpers/ProfileHelper.d.ts | 32 +- types/helpers/QuestConditionHelper.d.ts | 1 + types/helpers/QuestHelper.d.ts | 40 +- types/helpers/RagfairOfferHelper.d.ts | 47 +- types/helpers/RagfairSellHelper.d.ts | 4 +- types/helpers/RagfairServerHelper.d.ts | 36 +- types/helpers/RepairHelper.d.ts | 1 + types/helpers/TradeHelper.d.ts | 5 +- types/helpers/TraderHelper.d.ts | 57 +- types/helpers/WeightedRandomHelper.d.ts | 2 +- types/loaders/BundleLoader.d.ts | 3 + types/loaders/PreAkiModLoader.d.ts | 8 +- types/models/eft/common/IGlobals.d.ts | 966 +++++++++--------- types/models/eft/common/ILocation.d.ts | 14 + types/models/eft/common/ILocationBase.d.ts | 41 +- types/models/eft/common/ILooseLoot.d.ts | 15 +- types/models/eft/common/IPmcData.d.ts | 6 +- types/models/eft/common/Ixyz.d.ts | 5 + types/models/eft/common/tables/IBotBase.d.ts | 33 +- types/models/eft/common/tables/IBotType.d.ts | 24 +- .../eft/common/tables/ICustomizationItem.d.ts | 10 +- types/models/eft/common/tables/IItem.d.ts | 1 + types/models/eft/common/tables/ILootBase.d.ts | 37 +- types/models/eft/common/tables/IMatch.d.ts | 1 + .../eft/common/tables/IProfileTemplate.d.ts | 4 +- types/models/eft/common/tables/IQuest.d.ts | 12 +- .../eft/common/tables/ITemplateItem.d.ts | 39 +- .../eft/dialog/IAcceptFriendRequestData.d.ts | 6 +- .../dialog/IGetFriendListDataResponse.d.ts | 14 +- .../IGetMailDialogViewResponseData.d.ts | 4 +- .../models/eft/game/IGameConfigResponse.d.ts | 3 +- .../health/IHealthTreatmentRequestData.d.ts | 7 +- types/models/eft/hideout/IHideoutArea.d.ts | 4 + .../models/eft/inRaid/IInsuredItemsData.d.ts | 6 + .../eft/inRaid/ISaveProgressRequestData.d.ts | 9 +- .../eft/inventory/IAddItemRequestData.d.ts | 1 + .../eft/inventory/IAddItemTempObject.d.ts | 1 + .../IInventoryBaseActionRequestData.d.ts | 1 + .../IInventoryExamineRequestData.d.ts | 7 +- .../inventory/IInventorySplitRequestData.d.ts | 6 +- .../eft/itemEvent/IItemEventRouterBase.d.ts | 33 +- .../eft/location/IAirdropLootResult.d.ts | 5 + types/models/eft/notifier/INotifier.d.ts | 12 +- .../eft/notifier/ISelectProfileResponse.d.ts | 3 - .../IPresetBuildActionRequestData.d.ts | 9 +- .../presetBuild/IRemoveBuildRequestData.d.ts | 4 + types/models/eft/profile/IAkiProfile.d.ts | 32 +- .../eft/ragfair/IGetItemPriceResult.d.ts | 5 +- ...IStorePlayerOfferTaxAmountRequestData.d.ts | 6 + .../ISellScavItemsToFenceRequestData.d.ts | 6 + types/models/enums/AccountTypes.d.ts | 3 + types/models/enums/BackendErrorCodes.d.ts | 20 +- types/models/enums/BaseClasses.d.ts | 9 +- types/models/enums/ConfigTypes.d.ts | 5 +- types/models/enums/EquipmentBuildType.d.ts | 4 + types/models/enums/GiftSenderType.d.ts | 5 + types/models/enums/GiftSentResult.d.ts | 6 + types/models/enums/HideoutAreas.d.ts | 4 +- types/models/enums/ItemAddedResult.d.ts | 4 + types/models/enums/ItemEventActions.d.ts | 7 +- types/models/enums/PlayerRaidEndState.d.ts | 7 + types/models/enums/QuestRewardType.d.ts | 5 +- types/models/enums/QuestTypeEnum.d.ts | 15 + types/models/enums/SeasonalEventType.d.ts | 7 + types/models/enums/WeatherType.d.ts | 34 +- types/models/enums/WildSpawnTypeNumber.d.ts | 9 +- .../models/spt/callbacks/IDataCallbacks.d.ts | 2 - .../spt/callbacks/IPresetBuildCallbacks.d.ts | 14 +- types/models/spt/config/IAirdropConfig.d.ts | 22 +- types/models/spt/config/IBotConfig.d.ts | 62 +- types/models/spt/config/ICoreConfig.d.ts | 17 +- types/models/spt/config/IGiftsConfig.d.ts | 28 + types/models/spt/config/IHideoutConfig.d.ts | 2 +- types/models/spt/config/IInRaidConfig.d.ts | 8 + types/models/spt/config/IInsuranceConfig.d.ts | 6 +- types/models/spt/config/IInventoryConfig.d.ts | 15 +- types/models/spt/config/ILocationConfig.d.ts | 36 + types/models/spt/config/ILootConfig.d.ts | 9 + .../models/spt/config/ILostOnDeathConfig.d.ts | 3 + .../models/spt/config/IPlayerScavConfig.d.ts | 14 +- types/models/spt/config/IPmcConfig.d.ts | 30 +- types/models/spt/config/IQuestConfig.d.ts | 11 + types/models/spt/config/IRagfairConfig.d.ts | 43 +- types/models/spt/config/IScavCaseConfig.d.ts | 2 + .../spt/config/ISeasonalEventConfig.d.ts | 2 + types/models/spt/config/ITraderConfig.d.ts | 9 + types/models/spt/config/IWeatherConfig.d.ts | 2 +- .../spt/dialog/ISendMessageDetails.d.ts | 30 + types/models/spt/server/IDatabaseTables.d.ts | 3 + types/models/spt/server/ISettingsBase.d.ts | 5 + types/models/spt/services/CustomPreset.d.ts | 4 +- types/models/spt/services/LootRequest.d.ts | 1 + types/routers/EventOutputHolder.d.ts | 10 +- .../routers/serializers/NotifySerializer.d.ts | 4 +- types/servers/ConfigServer.d.ts | 3 +- types/servers/WebSocketServer.d.ts | 4 +- types/servers/http/AkiHttpListener.d.ts | 2 +- types/services/BotEquipmentFilterService.d.ts | 35 +- .../services/BotEquipmentModPoolService.d.ts | 4 +- types/services/FenceService.d.ts | 28 +- types/services/GiftService.d.ts | 50 + types/services/HashCacheService.d.ts | 11 + types/services/InsuranceService.d.ts | 111 +- types/services/LocalisationService.d.ts | 10 +- types/services/MailSendService.d.ts | 129 +++ .../services/MatchBotDetailsCacheService.d.ts | 10 +- types/services/ModCompilerService.d.ts | 25 +- types/services/PaymentService.d.ts | 18 +- types/services/PlayerService.d.ts | 21 +- types/services/ProfileFixerService.d.ts | 38 +- types/services/RagfairLinkedItemService.d.ts | 16 +- types/services/RagfairPriceService.d.ts | 27 +- .../RagfairTaxService.d.ts} | 11 +- types/services/RepairService.d.ts | 8 +- types/services/SeasonalEventService.d.ts | 52 +- .../TraderPurchasePersisterService.d.ts | 4 +- types/utils/App.d.ts | 5 +- types/utils/DatabaseImporter.d.ts | 11 +- types/utils/HashUtil.d.ts | 1 + types/utils/HttpResponseUtil.d.ts | 5 + types/utils/JsonUtil.d.ts | 56 +- types/utils/RagfairOfferHolder.d.ts | 10 +- types/utils/RandomUtil.d.ts | 14 +- types/utils/VFS.d.ts | 9 +- types/utils/Watermark.d.ts | 7 +- 204 files changed, 3533 insertions(+), 1269 deletions(-) create mode 100644 types/models/eft/common/Ixyz.d.ts create mode 100644 types/models/eft/inRaid/IInsuredItemsData.d.ts create mode 100644 types/models/eft/location/IAirdropLootResult.d.ts create mode 100644 types/models/eft/presetBuild/IRemoveBuildRequestData.d.ts create mode 100644 types/models/eft/ragfair/IStorePlayerOfferTaxAmountRequestData.d.ts create mode 100644 types/models/eft/trade/ISellScavItemsToFenceRequestData.d.ts create mode 100644 types/models/enums/AccountTypes.d.ts create mode 100644 types/models/enums/EquipmentBuildType.d.ts create mode 100644 types/models/enums/GiftSenderType.d.ts create mode 100644 types/models/enums/GiftSentResult.d.ts create mode 100644 types/models/enums/ItemAddedResult.d.ts create mode 100644 types/models/enums/PlayerRaidEndState.d.ts create mode 100644 types/models/enums/QuestTypeEnum.d.ts create mode 100644 types/models/enums/SeasonalEventType.d.ts create mode 100644 types/models/spt/config/IGiftsConfig.d.ts create mode 100644 types/models/spt/config/ILootConfig.d.ts create mode 100644 types/models/spt/dialog/ISendMessageDetails.d.ts create mode 100644 types/services/GiftService.d.ts create mode 100644 types/services/MailSendService.d.ts rename types/{helpers/RagfairTaxHelper.d.ts => services/RagfairTaxService.d.ts} (63%) 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/BundleCallbacks.d.ts b/types/callbacks/BundleCallbacks.d.ts index b7e1703..729b6cf 100644 --- a/types/callbacks/BundleCallbacks.d.ts +++ b/types/callbacks/BundleCallbacks.d.ts @@ -13,6 +13,9 @@ export declare class BundleCallbacks { protected httpConfig: IHttpConfig; constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); sendBundle(sessionID: string, req: any, resp: any, body: any): any; + /** + * Handle singleplayer/bundles + */ getBundles(url: string, info: any, sessionID: string): string; getBundle(url: string, info: any, sessionID: string): string; } diff --git a/types/callbacks/CustomizationCallbacks.d.ts b/types/callbacks/CustomizationCallbacks.d.ts index 75d5701..bb10f64 100644 --- a/types/callbacks/CustomizationCallbacks.d.ts +++ b/types/callbacks/CustomizationCallbacks.d.ts @@ -15,15 +15,21 @@ export declare class CustomizationCallbacks { protected httpResponse: HttpResponseUtil; constructor(customizationController: CustomizationController, saveServer: SaveServer, httpResponse: HttpResponseUtil); /** - * Handles client/trading/customization/storage - * @returns + * Handle client/trading/customization/storage + * @returns IGetSuitsResponse */ getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** - * Handles client/trading/customization + * Handle client/trading/customization * @returns ISuit[] */ getTraderSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle CustomizationWear event + */ wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle CustomizationBuy event + */ buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/types/callbacks/DataCallbacks.d.ts b/types/callbacks/DataCallbacks.d.ts index 26f5899..fb92560 100644 --- a/types/callbacks/DataCallbacks.d.ts +++ b/types/callbacks/DataCallbacks.d.ts @@ -4,7 +4,6 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IGlobals } from "../models/eft/common/IGlobals"; import { ICustomizationItem } from "../models/eft/common/tables/ICustomizationItem"; import { IHandbookBase } from "../models/eft/common/tables/IHandbookBase"; -import { IQuest } from "../models/eft/common/tables/IQuest"; import { IGetItemPricesResponse } from "../models/eft/game/IGetItemPricesResponse"; import { IHideoutArea } from "../models/eft/hideout/IHideoutArea"; import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; @@ -24,42 +23,54 @@ export declare class DataCallbacks { protected hideoutController: HideoutController; constructor(httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, ragfairController: RagfairController, hideoutController: HideoutController); /** - * Handles client/settings + * Handle client/settings * @returns ISettingsBase */ getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** - * Handles client/globals + * Handle client/globals * @returns IGlobals */ getGlobals(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** - * Handles client/items + * Handle client/items * @returns string */ getTemplateItems(url: string, info: IEmptyRequestData, sessionID: string): string; /** - * Handles client/handbook/templates + * Handle client/handbook/templates * @returns IHandbookBase */ getTemplateHandbook(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** - * Handles client/customization + * Handle client/customization * @returns Record>; /** - * Handles client/account/customization + * Handle client/account/customization * @returns string[] */ getTemplateCharacter(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getTemplateQuests(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/hideout/settings + * @returns IHideoutSettingsBase + */ getHideoutSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/languages + */ getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; + /** + * Handle client/menu/locale + */ getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/locale + */ getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; /** * Handle client/hideout/qte/list diff --git a/types/callbacks/DialogueCallbacks.d.ts b/types/callbacks/DialogueCallbacks.d.ts index 4ed6171..23cb707 100644 --- a/types/callbacks/DialogueCallbacks.d.ts +++ b/types/callbacks/DialogueCallbacks.d.ts @@ -1,7 +1,7 @@ import { DialogueController } from "../controllers/DialogueController"; import { OnUpdate } from "../di/OnUpdate"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { IAcceptFriendRequestData } from "../models/eft/dialog/IAcceptFriendRequestData"; +import { IAcceptFriendRequestData, ICancelFriendRequestData } from "../models/eft/dialog/IAcceptFriendRequestData"; import { IChatServer } from "../models/eft/dialog/IChatServer"; import { IClearMailMessageRequest } from "../models/eft/dialog/IClearMailMessageRequest"; import { IDeleteFriendRequest } from "../models/eft/dialog/IDeleteFriendRequest"; @@ -33,13 +33,13 @@ export declare class DialogueCallbacks implements OnUpdate { protected dialogueController: DialogueController; constructor(hashUtil: HashUtil, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, dialogueController: DialogueController); /** - * Handles client/friend/list + * Handle client/friend/list * @returns IGetFriendListDataResponse */ getFriendList(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** - * Handles client/chatServer/list - * @returns + * Handle client/chatServer/list + * @returns IChatServer[] */ getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/mail/dialog/list */ @@ -50,21 +50,47 @@ export declare class DialogueCallbacks implements OnUpdate { getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; /** Handle client/mail/dialog/remove */ removeDialog(url: string, info: IRemoveDialogRequestData, sessionID: string): IGetBodyResponseData; + /** Handle client/mail/dialog/pin */ pinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData; + /** Handle client/mail/dialog/unpin */ unpinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData; + /** Handle client/mail/dialog/read */ setRead(url: string, info: ISetDialogReadRequestData, sessionID: string): IGetBodyResponseData; /** - * Handles client/mail/dialog/getAllAttachments + * Handle client/mail/dialog/getAllAttachments * @returns IGetAllAttachmentsResponse */ getAllAttachments(url: string, info: IGetAllAttachmentsRequestData, sessionID: string): IGetBodyResponseData; + /** Handle client/mail/msg/send */ + sendMessage(url: string, request: ISendMessageRequest, sessionID: string): IGetBodyResponseData; /** Handle client/friend/request/list/outbox */ listOutbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/list/inbox + */ listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/send + */ sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/accept + */ acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/friend/request/cancel + */ + cancelFriendRequest(url: string, request: ICancelFriendRequestData, sessionID: string): IGetBodyResponseData; + /** Handle client/friend/delete */ deleteFriend(url: string, request: IDeleteFriendRequest, sessionID: string): INullResponseData; - sendMessage(url: string, request: ISendMessageRequest, sessionID: string): IGetBodyResponseData; + /** Handle client/friend/ignore/set */ + ignoreFriend(url: string, request: { + uid: string; + }, sessionID: string): any; + /** Handle client/friend/ignore/remove */ + unIgnoreFriend(url: string, request: { + uid: string; + }, sessionID: string): any; clearMail(url: string, request: IClearMailMessageRequest, sessionID: string): IGetBodyResponseData; removeMail(url: string, request: IRemoveMailMessageRequest, sessionID: string): IGetBodyResponseData; onUpdate(timeSinceLastRun: number): Promise; diff --git a/types/callbacks/GameCallbacks.d.ts b/types/callbacks/GameCallbacks.d.ts index a1ce037..46f79f9 100644 --- a/types/callbacks/GameCallbacks.d.ts +++ b/types/callbacks/GameCallbacks.d.ts @@ -1,6 +1,8 @@ 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"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IGameEmptyCrcRequestData } from "../models/eft/game/IGameEmptyCrcRequestData"; import { IGameKeepAliveResponse } from "../models/eft/game/IGameKeepAliveResponse"; @@ -14,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 @@ -41,8 +45,17 @@ declare class GameCallbacks { * @returns IGameConfigResponse */ getGameConfig(url: string, info: IGameEmptyCrcRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/server/list + */ getServer(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getCurrentGroup(url: string, info: IEmptyRequestData, sessionID: string): any; + /** + * Handle client/match/group/current + */ + getCurrentGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/checkVersion + */ validateGameVersion(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** * Handle client/game/keepalive diff --git a/types/callbacks/HideoutCallbacks.d.ts b/types/callbacks/HideoutCallbacks.d.ts index d0247f9..efd0444 100644 --- a/types/callbacks/HideoutCallbacks.d.ts +++ b/types/callbacks/HideoutCallbacks.d.ts @@ -23,11 +23,11 @@ export declare class HideoutCallbacks implements OnUpdate { constructor(hideoutController: HideoutController, // TODO: delay needed configServer: ConfigServer); /** - * Handle HideoutUpgrade + * Handle HideoutUpgrade event */ upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; /** - * Handle HideoutUpgradeComplete + * Handle HideoutUpgradeComplete event */ upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -35,19 +35,19 @@ export declare class HideoutCallbacks implements OnUpdate { */ putItemsInAreaSlots(pmcData: IPmcData, body: IHideoutPutItemInRequestData, sessionID: string): IItemEventRouterResponse; /** - * Handle HideoutTakeItemsFromAreaSlots + * Handle HideoutTakeItemsFromAreaSlots event */ takeItemsFromAreaSlots(pmcData: IPmcData, body: IHideoutTakeItemOutRequestData, sessionID: string): IItemEventRouterResponse; /** - * Handle HideoutToggleArea + * Handle HideoutToggleArea event */ toggleArea(pmcData: IPmcData, body: IHideoutToggleAreaRequestData, sessionID: string): IItemEventRouterResponse; /** - * Handle HideoutSingleProductionStart + * Handle HideoutSingleProductionStart event */ singleProductionStart(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** - * Handle HideoutScavCaseProductionStart + * Handle HideoutScavCaseProductionStart event */ scavCaseProductionStart(pmcData: IPmcData, body: IHideoutScavCaseStartRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -55,7 +55,7 @@ export declare class HideoutCallbacks implements OnUpdate { */ continuousProductionStart(pmcData: IPmcData, body: IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** - * Handle HideoutTakeProduction + * Handle HideoutTakeProduction event */ takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/types/callbacks/InraidCallbacks.d.ts b/types/callbacks/InraidCallbacks.d.ts index 918bfaf..d341956 100644 --- a/types/callbacks/InraidCallbacks.d.ts +++ b/types/callbacks/InraidCallbacks.d.ts @@ -12,6 +12,7 @@ export declare class InraidCallbacks { constructor(inraidController: InraidController, httpResponse: HttpResponseUtil); /** * Handle client/location/getLocalloot + * Store active map in profile + applicationContext * @param url * @param info register player request * @param sessionID Session id diff --git a/types/callbacks/InsuranceCallbacks.d.ts b/types/callbacks/InsuranceCallbacks.d.ts index aea0756..450a2fa 100644 --- a/types/callbacks/InsuranceCallbacks.d.ts +++ b/types/callbacks/InsuranceCallbacks.d.ts @@ -23,7 +23,7 @@ export declare class InsuranceCallbacks implements OnUpdate { */ getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; /** - * Handle Insure + * Handle Insure event * @returns IItemEventRouterResponse */ insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/types/callbacks/InventoryCallbacks.d.ts b/types/callbacks/InventoryCallbacks.d.ts index 46bf6fd..5d4b51d 100644 --- a/types/callbacks/InventoryCallbacks.d.ts +++ b/types/callbacks/InventoryCallbacks.d.ts @@ -21,21 +21,28 @@ 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; + /** Handle Swap */ swapItem(pmcData: IPmcData, body: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse; foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse; toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse; tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse; bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse; examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse; + /** Handle ReadEncyclopedia */ readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse; + /** Handle ApplyInventoryChanges */ sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse; createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + /** Handle OpenRandomLootContainer */ openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, 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/LocationCallbacks.d.ts b/types/callbacks/LocationCallbacks.d.ts index 6e0b538..da0d7cc 100644 --- a/types/callbacks/LocationCallbacks.d.ts +++ b/types/callbacks/LocationCallbacks.d.ts @@ -9,7 +9,10 @@ export declare class LocationCallbacks { protected httpResponse: HttpResponseUtil; protected locationController: LocationController; constructor(httpResponse: HttpResponseUtil, locationController: LocationController); + /** Handle client/locations */ getLocationData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** Handle client/location/getLocalloot */ getLocation(url: string, info: IGetLocationRequestData, sessionID: string): IGetBodyResponseData; + /** Handle client/location/getAirdropLoot */ getAirdropLoot(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/types/callbacks/MatchCallbacks.d.ts b/types/callbacks/MatchCallbacks.d.ts index b9341fd..0ed7d37 100644 --- a/types/callbacks/MatchCallbacks.d.ts +++ b/types/callbacks/MatchCallbacks.d.ts @@ -27,11 +27,14 @@ export declare class MatchCallbacks { protected matchController: MatchController; protected databaseServer: DatabaseServer; constructor(httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, matchController: MatchController, databaseServer: DatabaseServer); + /** Handle client/match/updatePing */ updatePing(url: string, info: IUpdatePingRequestData, sessionID: string): INullResponseData; exitMatch(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData; + /** Handle client/match/group/exit_from_menu */ exitToMenu(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData; startGroupSearch(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData; stopGroupSearch(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData; + /** Handle client/match/group/invite/send */ sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/invite/accept */ acceptGroupInvite(url: string, info: IAcceptGroupInviteRequest, sessionID: string): IGetBodyResponseData; @@ -39,21 +42,32 @@ export declare class MatchCallbacks { cancelGroupInvite(url: string, info: ICancelGroupInviteRequest, sessionID: string): IGetBodyResponseData; /** Handle client/match/group/transfer */ transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData; + /** Handle client/match/group/invite/cancel-all */ cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData; + /** @deprecated - not called on raid start/end or game start/exit */ putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData; + /** Handle raid/profile/list */ getProfile(url: string, info: IGetProfileRequestData, sessionID: string): IGetBodyResponseData; serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** Handle match/group/start_game */ joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; + /** Handle client/getMetricsConfig */ getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; /** + * @deprecated - not called on raid start/end or game start/exit * Handle client/match/group/status * @returns */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; + /** Handle client/match/group/create */ createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; + /** Handle client/match/group/delete */ deleteGroup(url: string, info: any, sessionID: string): INullResponseData; leaveGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** Handle client/match/group/player/remove */ removePlayerFromGroup(url: string, info: IRemovePlayerFromGroupRequest, sessionID: string): INullResponseData; + /** Handle client/match/offline/end */ endOfflineRaid(url: string, info: IEndOfflineRaidRequestData, sessionID: string): INullResponseData; + /** Handle client/raid/configuration */ getRaidConfiguration(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData; } diff --git a/types/callbacks/NoteCallbacks.d.ts b/types/callbacks/NoteCallbacks.d.ts index d39d400..cb1cbc8 100644 --- a/types/callbacks/NoteCallbacks.d.ts +++ b/types/callbacks/NoteCallbacks.d.ts @@ -5,7 +5,10 @@ import { INoteActionData } from "../models/eft/notes/INoteActionData"; export declare class NoteCallbacks { protected noteController: NoteController; constructor(noteController: NoteController); + /** Handle AddNote event */ addNote(pmcData: IPmcData, body: INoteActionData, sessionID: string): IItemEventRouterResponse; + /** Handle EditNote event */ editNote(pmcData: IPmcData, body: INoteActionData, sessionID: string): IItemEventRouterResponse; + /** Handle DeleteNote event */ deleteNote(pmcData: IPmcData, body: INoteActionData, sessionID: string): IItemEventRouterResponse; } diff --git a/types/callbacks/NotifierCallbacks.d.ts b/types/callbacks/NotifierCallbacks.d.ts index fab325b..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 @@ -18,7 +20,10 @@ export declare class NotifierCallbacks { * and the client would abort the connection due to spam. */ sendNotification(sessionID: string, req: any, resp: any, data: any): void; + /** Handle push/notifier/get */ + /** Handle push/notifier/getwebsocket */ getNotifier(url: string, info: any, sessionID: string): IGetBodyResponseData; + /** Handle client/notifier/channel/create */ createNotifierChannel(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** * Handle client/game/profile/select diff --git a/types/callbacks/PresetBuildCallbacks.d.ts b/types/callbacks/PresetBuildCallbacks.d.ts index 541715a..e5973a9 100644 --- a/types/callbacks/PresetBuildCallbacks.d.ts +++ b/types/callbacks/PresetBuildCallbacks.d.ts @@ -4,13 +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); - getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - removeBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; + /** Handle client/handbook/builds/my/list */ + 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/ProfileCallbacks.d.ts b/types/callbacks/ProfileCallbacks.d.ts index 9a5848e..77f6a27 100644 --- a/types/callbacks/ProfileCallbacks.d.ts +++ b/types/callbacks/ProfileCallbacks.d.ts @@ -20,16 +20,17 @@ export declare class ProfileCallbacks { protected timeUtil: TimeUtil; protected profileController: ProfileController; constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController); + /** + * Handle client/game/profile/create + */ createProfile(url: string, info: IProfileCreateRequestData, sessionID: string): IGetBodyResponseData; /** + * Handle client/game/profile/list * Get the complete player profile (scav + pmc character) - * @param url - * @param info Empty - * @param sessionID Session id - * @returns Profile object */ getProfileData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** + * Handle client/game/profile/savage/regenerate * Handle the creation of a scav profile for player * Occurs post-raid and when profile first created immediately after character details are confirmed by player * @param url @@ -40,33 +41,40 @@ export declare class ProfileCallbacks { regenerateScav(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** * Handle client/game/profile/voice/change event - * @param url - * @param info Change voice request object - * @param sessionID Session id - * @returns Client response */ changeVoice(url: string, info: IProfileChangeVoiceRequestData, sessionID: string): INullResponseData; /** * Handle client/game/profile/nickname/change event * Client allows player to adjust their profile name - * @param url - * @param info Change nickname request object - * @param sessionID Session id - * @returns client response */ changeNickname(url: string, info: IProfileChangeNicknameRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/profile/nickname/validate + */ validateNickname(url: string, info: IValidateNicknameRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/profile/nickname/reserved + */ getReservedNickname(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** + * Handle client/profile/status * Called when creating a character when choosing a character face/voice - * @param url - * @param info response (empty) - * @param sessionID - * @returns */ getProfileStatus(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/profile/settings + */ getProfileSettings(url: string, info: IGetProfileSettingsRequest, sessionId: string): IGetBodyResponseData; + /** + * Handle client/game/profile/search + */ searchFriend(url: string, info: ISearchFriendRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle launcher/profile/info + */ getMiniProfile(url: string, info: IGetMiniProfileRequestData, sessionID: string): string; - getAllMiniProfiles(url: string, info: any, sessionID: string): string; + /** + * Handle /launcher/profiles + */ + getAllMiniProfiles(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/types/callbacks/QuestCallbacks.d.ts b/types/callbacks/QuestCallbacks.d.ts index 2a3eb20..b3b37dd 100644 --- a/types/callbacks/QuestCallbacks.d.ts +++ b/types/callbacks/QuestCallbacks.d.ts @@ -17,17 +17,28 @@ export declare class QuestCallbacks { protected questController: QuestController; protected repeatableQuestController: RepeatableQuestController; constructor(httpResponse: HttpResponseUtil, questController: QuestController, repeatableQuestController: RepeatableQuestController); + /** + * Handle RepeatableQuestChange event + */ changeRepeatableQuest(pmcData: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; + /** + * Handle QuestAccept event + */ acceptQuest(pmcData: IPmcData, body: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle QuestComplete event + */ completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle QuestHandover event + */ handoverQuest(pmcData: IPmcData, body: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle client/quest/list - * @param url - * @param info - * @param sessionID - * @returns */ listQuests(url: string, info: IListQuestsRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/repeatalbeQuests/activityPeriods + */ activityPeriods(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; } diff --git a/types/callbacks/RagfairCallbacks.d.ts b/types/callbacks/RagfairCallbacks.d.ts index 97713e7..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,21 +29,32 @@ 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; + /** + * Handle client/ragfair/search + * Handle client/ragfair/find + */ search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData; + /** Handle client/ragfair/itemMarketPrice */ getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; + /** Handle RagFairAddOffer event */ addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** \Handle RagFairRemoveOffer event */ removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** Handle RagFairRenewOffer event */ extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle /client/items/prices * Called when clicking an item to list on flea */ getFleaPrices(url: string, request: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; - onUpdate(timeSinceLastRun: number): Promise; + /** 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/RepairCallbacks.d.ts b/types/callbacks/RepairCallbacks.d.ts index 14edeeb..283e0a3 100644 --- a/types/callbacks/RepairCallbacks.d.ts +++ b/types/callbacks/RepairCallbacks.d.ts @@ -7,19 +7,21 @@ export declare class RepairCallbacks { protected repairController: RepairController; constructor(repairController: RepairController); /** + * Handle TraderRepair event * use trader to repair item - * @param pmcData - * @param body - * @param sessionID - * @returns + * @param pmcData Player profile + * @param traderRepairRequest Request object + * @param sessionID Session id + * @returns IItemEventRouterResponse */ - traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + traderRepair(pmcData: IPmcData, traderRepairRequest: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; /** + * Handle Repair event * Use repair kit to repair item - * @param pmcData - * @param body - * @param sessionID - * @returns + * @param pmcData Player profile + * @param repairRequest Request object + * @param sessionID Session id + * @returns IItemEventRouterResponse */ - repair(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + repair(pmcData: IPmcData, repairRequest: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/types/callbacks/TradeCallbacks.d.ts b/types/callbacks/TradeCallbacks.d.ts index 4291da8..1c0cb32 100644 --- a/types/callbacks/TradeCallbacks.d.ts +++ b/types/callbacks/TradeCallbacks.d.ts @@ -3,12 +3,16 @@ 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); /** - * Handle client/game/profile/items/moving TradingConfirm + * Handle client/game/profile/items/moving TradingConfirm event */ 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/callbacks/TraderCallbacks.d.ts b/types/callbacks/TraderCallbacks.d.ts index 1e75add..4097e00 100644 --- a/types/callbacks/TraderCallbacks.d.ts +++ b/types/callbacks/TraderCallbacks.d.ts @@ -12,7 +12,10 @@ export declare class TraderCallbacks implements OnLoad, OnUpdate { onLoad(): Promise; onUpdate(): Promise; getRoute(): string; + /** Handle client/trading/api/traderSettings */ getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** Handle client/trading/api/getTrader */ getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** Handle client/trading/api/getTraderAssort */ getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; } diff --git a/types/callbacks/WishlistCallbacks.d.ts b/types/callbacks/WishlistCallbacks.d.ts index c2cc2a8..a118cc8 100644 --- a/types/callbacks/WishlistCallbacks.d.ts +++ b/types/callbacks/WishlistCallbacks.d.ts @@ -5,6 +5,8 @@ import { IWishlistActionData } from "../models/eft/wishlist/IWishlistActionData" export declare class WishlistCallbacks { protected wishlistController: WishlistController; constructor(wishlistController: WishlistController); + /** Handle AddToWishList event */ addToWishlist(pmcData: IPmcData, body: IWishlistActionData, sessionID: string): IItemEventRouterResponse; + /** Handle RemoveFromWishList event */ removeFromWishlist(pmcData: IPmcData, body: IWishlistActionData, sessionID: string): IItemEventRouterResponse; } diff --git a/types/controllers/BotController.d.ts b/types/controllers/BotController.d.ts index eebe85f..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); /** @@ -38,6 +40,7 @@ export declare class BotController { */ getBotPresetGenerationLimit(type: string): number; /** + * Handle singleplayer/settings/bot/difficulty * Get the core.json difficulty settings from database\bots * @returns IBotCore */ @@ -69,5 +72,5 @@ export declare class BotController { * @returns cap number */ getBotCap(): number; - getPmcBotTypes(): Record>>; + getAiBotBrainTypes(): any; } diff --git a/types/controllers/CustomizationController.d.ts b/types/controllers/CustomizationController.d.ts index 8735cae..f38feae 100644 --- a/types/controllers/CustomizationController.d.ts +++ b/types/controllers/CustomizationController.d.ts @@ -28,9 +28,13 @@ export declare class CustomizationController { * @returns ISuit array */ getTraderSuits(traderID: string, sessionID: string): ISuit[]; - /** Equip one to many clothing items to player */ + /** + * Handle CustomizationWear event + * Equip one to many clothing items to player + */ wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; /** + * Handle CustomizationBuy event * Purchase/unlock a clothing item from a trader * @param pmcData Player profile * @param buyClothingRequest Request object @@ -42,8 +46,8 @@ export declare class CustomizationController { /** * Has an outfit been purchased by a player * @param suitId clothing id - * @param sessionID Session id - * @returns true if purchased already + * @param sessionID Session id of profile to check for clothing in + * @returns true if already purchased */ protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean; /** @@ -60,7 +64,6 @@ export declare class CustomizationController { * @param pmcData Player profile * @param clothingItem Clothing item purchased * @param output Client response - * @returns */ protected payForClothingItem(sessionId: string, pmcData: IPmcData, clothingItem: ClothingItem, output: IItemEventRouterResponse): void; protected getAllTraderSuits(sessionID: string): ISuit[]; diff --git a/types/controllers/DialogueController.d.ts b/types/controllers/DialogueController.d.ts index 577375d..d673159 100644 --- a/types/controllers/DialogueController.d.ts +++ b/types/controllers/DialogueController.d.ts @@ -1,18 +1,43 @@ 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"; import { IGetMailDialogViewResponseData } from "../models/eft/dialog/IGetMailDialogViewResponseData"; -import { DialogueInfo, IAkiProfile, IUserDialogInfo, Message } from "../models/eft/profile/IAkiProfile"; +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; - constructor(saveServer: SaveServer, timeUtil: TimeUtil, dialogueHelper: DialogueHelper); + protected profileHelper: ProfileHelper; + protected randomUtil: RandomUtil; + protected mailSendService: MailSendService; + protected giftService: GiftService; + protected 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; + /** + * Handle client/friend/list + * @returns IGetFriendListDataResponse + */ getFriendList(sessionID: string): IGetFriendListDataResponse; /** + * Handle client/mail/dialog/list * Create array holding trader dialogs and mail interactions with player * Set the content of the dialogue on the list tab. * @param sessionID Session Id @@ -27,15 +52,37 @@ export declare class DialogueController { */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; /** + * Get the users involved in a dialog (player + other party) + * @param dialog The dialog to check for users + * @param messageType What type of message is being sent + * @param sessionID Player id + * @returns IUserDialogInfo array + */ + getDialogueUsers(dialog: Dialogue, messageType: MessageType, sessionID: string): IUserDialogInfo[]; + /** + * Handle client/mail/dialog/view * Handle player clicking 'messenger' and seeing all the messages they've recieved * Set the content of the dialogue on the details panel, showing all the messages * for the specified dialogue. - * @param dialogueID Dialog id - * @param sessionID Session id + * @param request Get dialog request + * @param sessionId Session id * @returns IGetMailDialogViewResponseData object */ - generateDialogueView(dialogueID: string, sessionID: string): IGetMailDialogViewResponseData; - protected getProfilesForMail(pmcProfile: IAkiProfile, dialogUsers: IUserDialogInfo[]): IUserDialogInfo[]; + generateDialogueView(request: IGetMailDialogViewRequestData, sessionId: string): IGetMailDialogViewResponseData; + /** + * Get dialog from player profile, create if doesn't exist + * @param profile Player profile + * @param request get dialog request (params used when dialog doesnt exist in profile) + * @returns Dialogue + */ + protected getDialogByIdFromProfile(profile: IAkiProfile, request: IGetMailDialogViewRequestData): Dialogue; + /** + * Get the users involved in a mail between two entities + * @param fullProfile Player profile + * @param dialogUsers The participants of the mail + * @returns IUserDialogInfo array + */ + protected getProfilesForMail(fullProfile: IAkiProfile, dialogUsers: IUserDialogInfo[]): IUserDialogInfo[]; /** * Get a count of messages with attachments from a particular dialog * @param sessionID Session id @@ -49,16 +96,39 @@ export declare class DialogueController { * @returns true if uncollected rewards found */ protected messagesHaveUncollectedRewards(messages: Message[]): boolean; - removeDialogue(dialogueID: string, sessionID: string): void; - setDialoguePin(dialogueID: string, shouldPin: boolean, sessionID: string): void; - 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; /** * Get messages from a specific dialog that have items not expired * @param sessionId Session id diff --git a/types/controllers/GameController.d.ts b/types/controllers/GameController.d.ts index 18c8091..b6903b7 100644 --- a/types/controllers/GameController.d.ts +++ b/types/controllers/GameController.d.ts @@ -8,30 +8,38 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { ICurrentGroupResponse } from "../models/eft/game/ICurrentGroupResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; +import { IGameKeepAliveResponse } from "../models/eft/game/IGameKeepAliveResponse"; import { IServerDetails } from "../models/eft/game/IServerDetails"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { 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; @@ -39,14 +47,54 @@ 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; protected os: any; 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, 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; + /** + * Handle client/game/config + */ + getGameConfig(sessionID: string): IGameConfigResponse; + /** + * Handle client/server/list + */ + getServer(sessionId: string): IServerDetails[]; + /** + * Handle client/match/group/current + */ + getCurrentGroup(sessionId: string): ICurrentGroupResponse; + /** + * Handle client/checkVersion + */ + getValidGameVersion(sessionId: string): ICheckVersionResponse; + /** + * Handle client/game/keepalive + */ + getKeepAlive(sessionId: string): IGameKeepAliveResponse; /** * BSG have two values for shotgun dispersion, we make sure both have the same value */ @@ -56,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 @@ -70,6 +119,11 @@ export declare class GameController { * Make Rogues spawn later to allow for scavs to spawn first instead of rogues filling up all spawn positions */ protected fixRoguesSpawningInstantlyOnLighthouse(): void; + /** + * Send starting gifts to profile after x days + * @param pmcProfile Profile to add gifts to + */ + protected sendPraporGiftsToNewProfiles(pmcProfile: IPmcData): void; /** * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these waves to one bot when they're waiting to spawn for too long */ @@ -79,11 +133,20 @@ export declare class GameController { * @param fullProfile Profile to add mod details to */ protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; + /** + * Check for any missing assorts inside each traders assort.json data, checking against traders qeustassort.json + */ + 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 */ @@ -93,8 +156,4 @@ export declare class GameController { */ protected adjustLabsRaiderSpawnRate(): void; protected logProfileDetails(fullProfile: IAkiProfile): void; - getGameConfig(sessionID: string): IGameConfigResponse; - getServer(): IServerDetails[]; - getCurrentGroup(sessionId: string): ICurrentGroupResponse; - getValidGameVersion(): ICheckVersionResponse; } diff --git a/types/controllers/HealthController.d.ts b/types/controllers/HealthController.d.ts index 7c149cc..2d7ff09 100644 --- a/types/controllers/HealthController.d.ts +++ b/types/controllers/HealthController.d.ts @@ -12,6 +12,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; export declare class HealthController { protected logger: ILogger; @@ -21,38 +22,42 @@ export declare class HealthController { protected paymentService: PaymentService; protected inventoryHelper: InventoryHelper; protected localisationService: LocalisationService; + protected httpResponse: HttpResponseUtil; protected healthHelper: HealthHelper; - constructor(logger: ILogger, jsonUtil: JsonUtil, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, localisationService: LocalisationService, healthHelper: HealthHelper); + constructor(logger: ILogger, jsonUtil: JsonUtil, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, localisationService: LocalisationService, httpResponse: HttpResponseUtil, healthHelper: HealthHelper); /** * 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; /** @@ -62,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 dd4235f..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"; @@ -59,6 +61,7 @@ export declare class HideoutController { protected hideoutConfig: IHideoutConfig; constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService); /** + * Handle HideoutUpgrade event * Start a hideout area upgrade * @param pmcData Player profile * @param request upgrade start request @@ -67,6 +70,7 @@ export declare class HideoutController { */ startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; /** + * Handle HideoutUpgradeComplete event * Complete a hideout area upgrade * @param pmcData Player profile * @param request Completed upgrade request @@ -74,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 @@ -84,6 +119,7 @@ export declare class HideoutController { */ putItemsInAreaSlots(pmcData: IPmcData, addItemToHideoutRequest: IHideoutPutItemInRequestData, sessionID: string): IItemEventRouterResponse; /** + * Handle HideoutTakeItemsFromAreaSlots event * Remove item from hideout area and place into player inventory * @param pmcData Player profile * @param request Take item out of area request @@ -102,6 +138,7 @@ export declare class HideoutController { */ protected removeResourceFromArea(sessionID: string, pmcData: IPmcData, removeResourceRequest: IHideoutTakeItemOutRequestData, output: IItemEventRouterResponse, hideoutArea: HideoutArea): IItemEventRouterResponse; /** + * Handle HideoutToggleArea event * Toggle area on/off * @param pmcData Player profile * @param request Toggle area request @@ -110,6 +147,7 @@ export declare class HideoutController { */ toggleArea(pmcData: IPmcData, request: IHideoutToggleAreaRequestData, sessionID: string): IItemEventRouterResponse; /** + * Handle HideoutSingleProductionStart event * Start production for an item from hideout area * @param pmcData Player profile * @param body Start prodution of single item request @@ -118,6 +156,7 @@ export declare class HideoutController { */ singleProductionStart(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** + * Handle HideoutScavCaseProductionStart event * Handles event after clicking 'start' on the scav case hideout page * @param pmcData player profile * @param body client request object @@ -149,6 +188,7 @@ export declare class HideoutController { */ continuousProductionStart(pmcData: IPmcData, request: IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** + * Handle HideoutTakeProduction event * Take completed item out of hideout area and place into player inventory * @param pmcData Player profile * @param request Remove production from area request @@ -167,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 70c1dab..6e86c63 100644 --- a/types/controllers/InraidController.d.ts +++ b/types/controllers/InraidController.d.ts @@ -10,6 +10,7 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; +import { PlayerRaidEndState } from "../models/enums/PlayerRaidEndState"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -52,6 +53,7 @@ export declare class InraidController { */ addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; /** + * Handle raid/profile/save * Save profile state to disk * Handles pmc/pscav * @param offraidData post-raid request data @@ -98,14 +100,12 @@ export declare class InraidController { * @param statusOnExit exit value from offraidData object * @returns true if dead */ - protected isPlayerDead(statusOnExit: string): boolean; + protected isPlayerDead(statusOnExit: PlayerRaidEndState): boolean; /** * 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 ccbd0a0..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,25 +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 - */ - protected itemShouldBeLost(insuredItem: Item, traderId: string, itemsBeingDeleted: string[]): boolean; + * 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 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 @@ -53,10 +166,12 @@ export declare class InsuranceController { */ insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; /** + * 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 9bc6594..5e7d19a 100644 --- a/types/controllers/InventoryController.d.ts +++ b/types/controllers/InventoryController.d.ts @@ -1,10 +1,11 @@ +import { LootGenerator } from "../generators/LootGenerator"; import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; +import { QuestHelper } from "../helpers/QuestHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; import { IInventoryCreateMarkerRequestData } from "../models/eft/inventory/IInventoryCreateMarkerRequestData"; import { IInventoryDeleteMarkerRequestData } from "../models/eft/inventory/IInventoryDeleteMarkerRequestData"; @@ -37,19 +38,21 @@ export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; + protected questHelper: QuestHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; - protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; + protected lootGenerator: LootGenerator; protected eventOutputHolder: EventOutputHolder; protected httpResponseUtil: HttpResponseUtil; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId @@ -61,41 +64,58 @@ export declare class InventoryController { * @returns IItemEventRouterResponse */ moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Get a event router response with inventory trader message + * @param output Item event router response + * @returns Item event router response + */ + protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Remove Item from Profile * Deep tree item deletion, also removes items from insurance list */ 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; - /** - * Give Item - * its used for "add" item like gifts etc. - */ - addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; + swapItem(pmcData: IPmcData, request: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse; /** * Handles folding of Weapons */ @@ -179,6 +199,7 @@ export declare class InventoryController { */ protected sanitiseMapMarkerText(mapNoteText: string): string; /** + * Handle OpenRandomLootContainer event * Handle event fired when a container is unpacked (currently only the halloween pumpkin) * @param pmcData Profile data * @param body open loot container request data 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 bd9815c..94f5fce 100644 --- a/types/controllers/LocationController.d.ts +++ b/types/controllers/LocationController.d.ts @@ -3,9 +3,11 @@ import { LootGenerator } from "../generators/LootGenerator"; 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 { LootItem } from "../models/spt/services/LootItem"; +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,20 +30,36 @@ 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); - get(location: string): ILocationBase; - generate(name: string): ILocationBase; + 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 sessionId Player id + * @param request Map request to generate + * @returns ILocationBase + */ + get(sessionId: string, request: IGetLocationRequestData): ILocationBase; + /** + * Generate a maps base location with loot + * @param name Map name + * @returns ILocationBase + */ + protected generate(name: string): ILocationBase; + /** + * Handle client/locations * Get all maps base location properties without loot data + * @param sessionId Players Id * @returns ILocationsGenerateAllResponse */ - generateAll(): ILocationsGenerateAllResponse; + generateAll(sessionId: string): ILocationsGenerateAllResponse; /** + * Handle client/location/getAirdropLoot * Get loot for an airdop container * Generates it randomly based on config/airdrop.json values * @returns Array of LootItem objects */ - getAirdropLoot(): LootItem[]; + getAirdropLoot(): IAirdropLootResult; /** * Randomly pick a type of airdrop loot using weighted values from config * @returns airdrop type value diff --git a/types/controllers/MatchController.d.ts b/types/controllers/MatchController.d.ts index f7418bf..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,18 +32,23 @@ 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 */ getProfile(info: IGetProfileRequestData): IPmcData[]; + /** Handle client/match/group/create */ createGroup(sessionID: string, info: ICreateGroupRequestData): any; + /** Handle client/match/group/delete */ deleteGroup(info: any): void; + /** Handle match/group/start_game */ joinMatch(info: IJoinMatchRequestData, sessionId: string): IJoinMatchResult; + /** Handle client/match/group/status */ getGroupStatus(info: IGetGroupStatusRequestData): any; /** * Handle /client/raid/configuration - * @param request - * @param sessionID + * @param request Raid config request + * @param sessionID Session id */ startOfflineRaid(request: IGetRaidConfigurationRequestData, sessionID: string): void; /** @@ -52,9 +57,10 @@ export declare class MatchController { * @returns bot difficulty */ protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: string): string; + /** Handle client/match/offline/end */ endOfflineRaid(info: IEndOfflineRaidRequestData, sessionId: string): void; /** - * Is extract by car + * Was extract by car * @param extractName name of extract * @returns true if car extract */ diff --git a/types/controllers/NotifierController.d.ts b/types/controllers/NotifierController.d.ts index 31d7bfe..de354ec 100644 --- a/types/controllers/NotifierController.d.ts +++ b/types/controllers/NotifierController.d.ts @@ -18,5 +18,6 @@ export declare class NotifierController { */ notifyAsync(sessionID: string): Promise; getServer(sessionID: string): string; + /** Handle client/notifier/channel/create */ getChannel(sessionID: string): INotifierChannel; } diff --git a/types/controllers/PresetBuildController.d.ts b/types/controllers/PresetBuildController.d.ts index 65ae0c4..d7bd3f3 100644 --- a/types/controllers/PresetBuildController.d.ts +++ b/types/controllers/PresetBuildController.d.ts @@ -2,17 +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); - getUserBuilds(sessionID: string): WeaponBuild[]; - saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; - removeBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse; + constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer); + /** Handle client/handbook/builds/my/list */ + 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/ProfileController.d.ts b/types/controllers/ProfileController.d.ts index 03d81d4..ffccdaf 100644 --- a/types/controllers/ProfileController.d.ts +++ b/types/controllers/ProfileController.d.ts @@ -14,40 +14,88 @@ import { IProfileCreateRequestData } from "../models/eft/profile/IProfileCreateR import { ISearchFriendRequestData } from "../models/eft/profile/ISearchFriendRequestData"; import { ISearchFriendResponse } from "../models/eft/profile/ISearchFriendResponse"; import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; +import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; +import { MailSendService } from "../services/MailSendService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class ProfileController { + protected logger: ILogger; protected hashUtil: HashUtil; protected timeUtil: TimeUtil; protected saveServer: SaveServer; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected profileFixerService: ProfileFixerService; + protected localisationService: LocalisationService; + protected mailSendService: MailSendService; protected playerScavGenerator: PlayerScavGenerator; protected eventOutputHolder: EventOutputHolder; protected traderHelper: TraderHelper; protected dialogueHelper: DialogueHelper; protected questHelper: QuestHelper; protected profileHelper: ProfileHelper; - constructor(hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper); + /** + * Handle /launcher/profiles + */ getMiniProfiles(): IMiniProfile[]; + /** + * Handle launcher/profile/info + */ getMiniProfile(sessionID: string): any; + /** + * Handle client/game/profile/list + */ getCompleteProfile(sessionID: string): IPmcData[]; + /** + * Handle client/game/profile/create + */ createProfile(info: IProfileCreateRequestData, sessionID: string): void; + /** + * Delete a profile + * @param sessionID Id of profile to delete + */ + protected deleteProfileBySessionId(sessionID: string): void; + /** + * Iterate over all quests in player profile, inspect rewards for the quests current state (accepted/completed) + * and send rewards to them in mail + * @param profileDetails Player profile + * @param sessionID Session id + * @param response Event router response + */ protected givePlayerStartingQuestRewards(profileDetails: IAkiProfile, sessionID: string, response: IItemEventRouterResponse): void; + /** + * For each trader reset their state to what a level 1 player would see + * @param sessionID Session id of profile to reset + */ + protected resetAllTradersInProfile(sessionID: string): void; /** * Generate a player scav object - * pmc profile MUST exist first before pscav can be generated + * PMC profile MUST exist first before pscav can be generated * @param sessionID * @returns IPmcData object */ generatePlayerScav(sessionID: string): IPmcData; + /** + * Handle client/game/profile/nickname/validate + */ validateNickname(info: IValidateNicknameRequestData, sessionID: string): string; + /** + * Handle client/game/profile/nickname/change event + * Client allows player to adjust their profile name + */ changeNickname(info: IProfileChangeNicknameRequestData, sessionID: string): string; + /** + * Handle client/game/profile/voice/change event + */ changeVoice(info: IProfileChangeVoiceRequestData, sessionID: string): void; + /** + * Handle client/game/profile/search + */ getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[]; } diff --git a/types/controllers/QuestController.d.ts b/types/controllers/QuestController.d.ts index 48efeef..bd8a70f 100644 --- a/types/controllers/QuestController.d.ts +++ b/types/controllers/QuestController.d.ts @@ -3,7 +3,9 @@ import { ItemHelper } from "../helpers/ItemHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; 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"; @@ -18,33 +20,54 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; import { LocalisationService } from "../services/LocalisationService"; +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; protected itemHelper: ItemHelper; protected dialogueHelper: DialogueHelper; + protected mailSendService: MailSendService; protected profileHelper: ProfileHelper; + protected traderHelper: TraderHelper; protected questHelper: QuestHelper; protected questConditionHelper: QuestConditionHelper; protected playerService: PlayerService; protected localeService: LocaleService; + protected seasonalEventService: SeasonalEventService; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, httpResponseUtil: HttpResponseUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, localisationService: LocalisationService, configServer: ConfigServer); + 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 * Exclude quests with incomplete preconditions (level/loyalty) * @param sessionID session id * @returns array of IQuest */ getClientQuests(sessionID: string): IQuest[]; + /** + * Does a provided quest have a level requirement equal to or below defined level + * @param quest Quest to check + * @param playerLevel level of player to test against quest + * @returns true if quest can be seen/accepted by player of defined level + */ + protected playerLevelFulfillsQuestRequirement(quest: IQuest, playerLevel: number): boolean; + /** + * Should a quest be shown to the player in trader quest screen + * @param questId Quest to check + * @returns true = show to player + */ + protected showEventQuestToPlayer(questId: string): boolean; /** * Is the quest for the opposite side the player is on * @param playerSide Player side (usec/bear) @@ -52,6 +75,7 @@ export declare class QuestController { */ protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** + * Handle QuestAccept event * Handle the client accepting a quest and starting it * Send starting rewards if any to player and * Send start notification if any to player @@ -79,15 +103,23 @@ export declare class QuestController { */ protected getRepeatableQuestFromProfile(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData): IRepeatableQuest; /** + * Handle QuestComplete event * Update completed quest in profile * Add newly unlocked quests to profile - * Also recalculate thier level due to exp rewards + * Also recalculate their level due to exp rewards * @param pmcData Player profile * @param body Completed quest request * @param sessionID Session id * @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 @@ -110,15 +142,16 @@ 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 * @param handoverQuestRequest handover item request * @param sessionID Session id diff --git a/types/controllers/RagfairController.d.ts b/types/controllers/RagfairController.d.ts index b94ad20..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 @@ -120,11 +121,23 @@ export declare class RagfairController { /** * List item(s) on flea for sale * @param pmcData Player profile - * @param offerRequest Flea list creatio offer + * @param offerRequest Flea list creation offer * @param sessionID Session id * @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/RepairController.d.ts b/types/controllers/RepairController.d.ts index fd8ff72..b19b1b7 100644 --- a/types/controllers/RepairController.d.ts +++ b/types/controllers/RepairController.d.ts @@ -23,6 +23,7 @@ export declare class RepairController { protected repairConfig: IRepairConfig; constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); /** + * Handle TraderRepair event * Repair with trader * @param sessionID session id * @param body endpoint request data @@ -31,6 +32,7 @@ export declare class RepairController { */ traderRepair(sessionID: string, body: ITraderRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; /** + * Handle Repair event * Repair with repair kit * @param sessionID session id * @param body endpoint request data diff --git a/types/controllers/RepeatableQuestController.d.ts b/types/controllers/RepeatableQuestController.d.ts index 171062d..e9d2e56 100644 --- a/types/controllers/RepeatableQuestController.d.ts +++ b/types/controllers/RepeatableQuestController.d.ts @@ -77,7 +77,7 @@ export declare class RepeatableQuestController { protected questConfig: IQuestConfig; constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** - * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint + * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. * repeatableQuestObject = { * id: Unique Id, @@ -113,7 +113,7 @@ export declare class RepeatableQuestController { * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest */ - generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + protected generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Just for debug reasons. Draws dailies a random assort of dailies extracted from dumps */ @@ -128,7 +128,7 @@ export declare class RepeatableQuestController { * @returns {object} a object which contains the base elements for repeatable quests of the requests type * (needs to be filled with reward and conditions by called to make a valid quest) */ - generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; + protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; /** * Generates a valid Exploration quest * @@ -138,7 +138,7 @@ export declare class RepeatableQuestController { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) */ - generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; /** * Generates a valid Completion quest * @@ -147,7 +147,7 @@ export declare class RepeatableQuestController { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) */ - generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; /** * Generates a valid Elimination quest * @@ -157,7 +157,7 @@ export declare class RepeatableQuestController { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ - generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; /** * Get the relevant elimination config based on the current players PMC level * @param pmcLevel Level of PMC character @@ -178,7 +178,7 @@ export declare class RepeatableQuestController { * @param {string} exit The exit name to generate the condition for * @returns {object} Exit condition */ - generateExplorationExitCondition(exit: Exit): IExplorationCondition; + protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; /** * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) @@ -187,7 +187,7 @@ export declare class RepeatableQuestController { * @param {integer} value amount of items of this specific type to request * @returns {object} object of "Completion"-condition */ - generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; + protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; /** * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) * This is a helper method for GenerateEliminationQuest to create a location condition. @@ -195,7 +195,7 @@ export declare class RepeatableQuestController { * @param {string} location the location on which to fulfill the elimination quest * @returns {object} object of "Elimination"-location-subcondition */ - generateEliminationLocation(location: string[]): IEliminationCondition; + protected generateEliminationLocation(location: string[]): IEliminationCondition; /** * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) * This is a helper method for GenerateEliminationQuest to create a kill condition. @@ -205,7 +205,7 @@ export declare class RepeatableQuestController { * @param {number} distance distance from which to kill (currently only >= supported) * @returns {object} object of "Elimination"-kill-subcondition */ - generateEliminationCondition(target: string, bodyPart: string[], distance: number): IEliminationCondition; + protected generateEliminationCondition(target: string, bodyPart: string[], distance: number): IEliminationCondition; /** * Used to create a quest pool during each cycle of repeatable quest generation. The pool will be subsequently * narrowed down during quest generation to avoid duplicate quests. Like duplicate extractions or elimination quests @@ -214,7 +214,7 @@ export declare class RepeatableQuestController { * @param pmcLevel level of pmc generating quest pool * @returns IQuestTypePool */ - generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; + protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; /** * Generate the reward for a mission. A reward can consist of * - Experience @@ -235,7 +235,7 @@ export declare class RepeatableQuestController { * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of "Reward"-type that can be given for a repeatable mission */ - generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; + protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; /** * Helper to create a reward item structured as required by the client * @@ -244,9 +244,12 @@ export declare class RepeatableQuestController { * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index * @returns {object} object of "Reward"-item-type */ - generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; debugLogRepeatableQuestIds(pmcData: IPmcData): void; - probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; + protected probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; + /** + * Handle RepeatableQuestChange event + */ changeRepeatableQuest(pmcData: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; /** * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) @@ -260,5 +263,5 @@ export declare class RepeatableQuestController { * @param {string} tpl template id of item to check * @returns boolean: true if item is valid reward */ - isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; } diff --git a/types/controllers/TradeController.d.ts b/types/controllers/TradeController.d.ts index 8a0630b..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,22 +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/controllers/TraderController.d.ts b/types/controllers/TraderController.d.ts index 007901b..5e31c43 100644 --- a/types/controllers/TraderController.d.ts +++ b/types/controllers/TraderController.d.ts @@ -35,6 +35,7 @@ export declare class TraderController { */ update(): boolean; /** + * Handle client/trading/api/traderSettings * Return an array of all traders * @param sessionID Session id * @returns array if ITraderBase objects @@ -47,6 +48,8 @@ export declare class TraderController { * @returns 1,-1 or 0 */ protected sortByTraderId(traderA: ITraderBase, traderB: ITraderBase): number; + /** Handle client/trading/api/getTrader */ getTrader(sessionID: string, traderID: string): ITraderBase; + /** Handle client/trading/api/getTraderAssort */ getAssort(sessionId: string, traderId: string): ITraderAssort; } diff --git a/types/controllers/WeatherController.d.ts b/types/controllers/WeatherController.d.ts index 631a90c..eeace8c 100644 --- a/types/controllers/WeatherController.d.ts +++ b/types/controllers/WeatherController.d.ts @@ -9,6 +9,7 @@ export declare class WeatherController { protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; constructor(weatherGenerator: WeatherGenerator, logger: ILogger, configServer: ConfigServer); + /** Handle client/weather */ generate(): IWeatherData; /** * Get the current in-raid time (MUST HAVE PLAYER LOGGED INTO CLIENT TO WORK) diff --git a/types/controllers/WishlistController.d.ts b/types/controllers/WishlistController.d.ts index 60c4a15..53a240f 100644 --- a/types/controllers/WishlistController.d.ts +++ b/types/controllers/WishlistController.d.ts @@ -5,6 +5,8 @@ import { IWishlistActionData } from "../models/eft/wishlist/IWishlistActionData" export declare class WishlistController { protected eventOutputHolder: EventOutputHolder; constructor(eventOutputHolder: EventOutputHolder); + /** Handle AddToWishList */ addToWishList(pmcData: IPmcData, body: IWishlistActionData, sessionID: string): IItemEventRouterResponse; + /** Handle RemoveFromWishList event */ removeFromWishList(pmcData: IPmcData, body: IWishlistActionData, sessionID: string): IItemEventRouterResponse; } diff --git a/types/di/Router.d.ts b/types/di/Router.d.ts index 2fb98e0..d2b4209 100644 --- a/types/di/Router.d.ts +++ b/types/di/Router.d.ts @@ -2,10 +2,10 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; export declare class Router { - private handledRoutes; + protected handledRoutes: HandledRoute[]; getTopLevelRoute(): string; protected getHandledRoutes(): HandledRoute[]; - private getInternalHandledRoutes; + protected getInternalHandledRoutes(): HandledRoute[]; canHandle(url: string, partialMatch?: boolean): boolean; } export declare class StaticRouter extends Router { 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/BotLevelGenerator.d.ts b/types/generators/BotLevelGenerator.d.ts index 751e6e6..56005a5 100644 --- a/types/generators/BotLevelGenerator.d.ts +++ b/types/generators/BotLevelGenerator.d.ts @@ -1,6 +1,6 @@ import { MinMax } from "../models/common/MinMax"; import { IRandomisedBotLevelResult } from "../models/eft/bot/IRandomisedBotLevelResult"; -import { ExpTable } from "../models/eft/common/IGlobals"; +import { IExpTable } from "../models/eft/common/IGlobals"; import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -25,5 +25,5 @@ export declare class BotLevelGenerator { * @param relativeDeltaMax max delta above player level to go * @returns highest level possible for bot */ - protected getHighestRelativeBotLevel(playerLevel: number, relativeDeltaMax: number, levelDetails: MinMax, expTable: ExpTable[]): number; + protected getHighestRelativeBotLevel(playerLevel: number, relativeDeltaMax: number, levelDetails: MinMax, expTable: IExpTable[]): number; } diff --git a/types/generators/BotLootGenerator.d.ts b/types/generators/BotLootGenerator.d.ts index c847d4d..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; /** @@ -65,22 +89,22 @@ export declare class BotLootGenerator { protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; /** * Get a random item from the pool parameter using the biasedRandomNumber system - * @param pool pool of items to pick an item from - * @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 getRandomItemFromPool(pool: ITemplateItem[], isPmc: boolean): ITemplateItem; + protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; /** * Get the loot nvalue from botconfig - * @param isPmc if true the pmc nvalue is returned + * @param botRole Role of bot e.g. assault/bosstagilla/sptBear * @returns nvalue as number */ - protected getBotLootNValue(isPmc: boolean): 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; @@ -89,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 3e9fe30..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,10 +68,17 @@ 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; + /** + * Insert a cartridge into a weapon + * @param weaponWithModsArray Weapon and mods + * @param ammoTpl Cartridge to add to weapon + * @param desiredSlotId name of slot, e.g. patron_in_weapon + */ + protected addCartridgeToChamber(weaponWithModsArray: Item[], ammoTpl: string, desiredSlotId: string): void; /** * Create array with weapon base as only element and * add additional properties based on weapon type @@ -97,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/FenceBaseAssortGenerator.d.ts b/types/generators/FenceBaseAssortGenerator.d.ts index 387df3a..486c4bd 100644 --- a/types/generators/FenceBaseAssortGenerator.d.ts +++ b/types/generators/FenceBaseAssortGenerator.d.ts @@ -6,15 +6,17 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; +import { SeasonalEventService } from "../services/SeasonalEventService"; export declare class FenceBaseAssortGenerator { protected logger: ILogger; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; protected itemHelper: ItemHelper; protected itemFilterService: ItemFilterService; + protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** * Create base fence assorts dynamically and store in db */ diff --git a/types/generators/LocationGenerator.d.ts b/types/generators/LocationGenerator.d.ts index 04b1599..46a514b 100644 --- a/types/generators/LocationGenerator.d.ts +++ b/types/generators/LocationGenerator.d.ts @@ -2,25 +2,35 @@ import { ContainerHelper } from "../helpers/ContainerHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; -import { ILooseLoot, Spawnpoint, SpawnpointsForced, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; +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"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { RandomUtil } from "../utils/RandomUtil"; +import { ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; export interface IContainerItem { items: Item[]; 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,17 +43,72 @@ 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); /** - * Choose loot to put into a static container - * @param containerIn - * @param staticForced - * @param staticLootDist - * @param staticAmmoDist + * 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 + * @param staticContainer The container itself we will add loot to + * @param staticForced Loot we need to force into the container + * @param staticLootDist staticLoot.json + * @param staticAmmoDist staticAmmo.json * @param locationName Name of the map to generate static loot for * @returns IStaticContainerProps */ - generateContainerLoot(containerIn: 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 + * @returns number[][] + */ + protected getContainerMapping(containerTpl: string): number[][]; + /** + * Look up a containers itemcountDistribution data and choose an item count based on the found weights + * @param containerTypeId Container to get item count for + * @param staticLootDist staticLoot.json + * @param locationName Map name (to get per-map multiplier for from config) + * @returns item count + */ + protected getWeightedCountOfContainerItems(containerTypeId: string, staticLootDist: Record, locationName: string): number; + /** + * Get all possible loot items that can be placed into a container + * Do not add seasonal items if found + current date is inside seasonal event + * @param containerTypeId Contianer to get possible loot for + * @param staticLootDist staticLoot.json + * @returns ProbabilityObjectArray of item tpls + probabilty + */ + protected getPossibleLootItemsForContainer(containerTypeId: string, staticLootDist: Record): ProbabilityObjectArray; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; /** @@ -65,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/LootGenerator.d.ts b/types/generators/LootGenerator.d.ts index 565ad32..fd7f2c2 100644 --- a/types/generators/LootGenerator.d.ts +++ b/types/generators/LootGenerator.d.ts @@ -1,12 +1,18 @@ +import { InventoryHelper } from "../helpers/InventoryHelper"; import { ItemHelper } from "../helpers/ItemHelper"; -import { Preset } from "../models/eft/common/IGlobals"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; +import { IPreset } from "../models/eft/common/IGlobals"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { AddItem } from "../models/eft/inventory/IAddItemRequestData"; +import { ISealedAirdropContainerSettings, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { LootItem } from "../models/spt/services/LootItem"; import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; +import { RagfairLinkedItemService } from "../services/RagfairLinkedItemService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; type ItemLimit = { @@ -19,9 +25,13 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected inventoryHelper: InventoryHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected ragfairLinkedItemService: RagfairLinkedItemService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated @@ -61,9 +71,43 @@ export declare class LootGenerator { * @param result array to add found preset to * @returns true if preset was valid and added to pool */ - protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, Preset][], itemTypeCounts: Record, itemBlacklist: string[], result: LootItem[]): boolean; + /** + * Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) + * @param containerSettings sealed weapon container settings + * @returns Array of items to add to player inventory + */ + getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[]; + /** + * Get non-weapon mod rewards for a sealed container + * @param containerSettings Sealed weapon container settings + * @param weaponDetailsDb Details for the weapon to reward player + * @returns AddItem array + */ + protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[]; + /** + * Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player + * @param containerSettings Sealed weapon container settings + * @param linkedItemsToWeapon All items that can be attached/inserted into weapon + * @param chosenWeaponPreset The weapon preset given to player as reward + * @returns AddItem array + */ + protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): AddItem[]; + /** + * Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards + * @param rewardContainerDetails + * @returns AddItem array + */ + getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[]; + /** + * A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication + * Default adds 1, or increments count + * @param itemTplToAdd items tpl we want to add to array + * @param resultsArray Array to add item tpl to + */ + protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void; } export {}; 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/RagfairAssortGenerator.d.ts b/types/generators/RagfairAssortGenerator.d.ts index 630e863..b26b6e1 100644 --- a/types/generators/RagfairAssortGenerator.d.ts +++ b/types/generators/RagfairAssortGenerator.d.ts @@ -1,5 +1,5 @@ import { ItemHelper } from "../helpers/ItemHelper"; -import { Preset } from "../models/eft/common/IGlobals"; +import { IPreset } from "../models/eft/common/IGlobals"; import { Item } from "../models/eft/common/tables/IItem"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ConfigServer } from "../servers/ConfigServer"; @@ -36,12 +36,12 @@ export declare class RagfairAssortGenerator { * Get presets from globals.json * @returns Preset object array */ - protected getPresets(): Preset[]; + protected getPresets(): IPreset[]; /** * Get default presets from globals.json * @returns Preset object array */ - protected getDefaultPresets(): Preset[]; + protected getDefaultPresets(): IPreset[]; /** * Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true * @param tplId tplid to add to item diff --git a/types/generators/RagfairOfferGenerator.d.ts b/types/generators/RagfairOfferGenerator.d.ts index 35fceff..58e0b68 100644 --- a/types/generators/RagfairOfferGenerator.d.ts +++ b/types/generators/RagfairOfferGenerator.d.ts @@ -48,13 +48,34 @@ export declare class RagfairOfferGenerator { price: number; }[]; constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, handbookHelper: HandbookHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, localisationService: LocalisationService, paymentHelper: PaymentHelper, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); - createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Create a flea offer and store it in the Ragfair server offers array + * @param userID Owner of the offer + * @param time Time offer is listed at + * @param items Items in the offer + * @param barterScheme Cost of item (currency or barter) + * @param loyalLevel Loyalty level needed to buy item + * @param sellInOnePiece Flags sellInOnePiece to be true + * @returns 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 + * @param time Time offer is listed at + * @param items Items in the offer + * @param barterScheme Cost of item (currency or barter) + * @param loyalLevel Loyalty level needed to buy item + * @param sellInOnePiece Set StackObjectsCount to 1 + * @returns 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 @@ -69,8 +90,18 @@ export declare class RagfairOfferGenerator { * @returns count of roubles */ protected calculateRoublePrice(currencyCount: number, currencyType: string): number; - protected getTraderId(userID: string): string; - protected getRating(userID: string): number; + /** + * Check userId, if its a player, return their pmc _id, otherwise return userId parameter + * @param userId Users Id to check + * @returns Users Id + */ + protected getTraderId(userId: string): string; + /** + * Get a flea trading rating for the passed in user + * @param userId User to get flea rating of + * @returns Flea rating value + */ + protected getRating(userId: string): number; /** * Is the offers user rating growing * @param userID user to check rating of @@ -89,15 +120,22 @@ export declare class RagfairOfferGenerator { * @param expiredOffers optional, expired offers to regenerate */ generateDynamicOffers(expiredOffers?: Item[]): Promise; + /** + * + * @param assortItemIndex Index of assort item + * @param assortItemsToProcess Item array containing index + * @param expiredOffers Currently expired offers on flea + * @param config Ragfair dynamic config + */ protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; /** * Create one flea offer for a specific item * @param items Item to create offer for * @param isPreset Is item a weapon preset * @param itemDetails raw db item details - * @returns + * @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 @@ -111,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 @@ -142,9 +180,9 @@ export declare class RagfairOfferGenerator { /** * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based * @param offerItems Items for sale in offer - * @returns barter scheme + * @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 @@ -156,19 +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[]; - /** - * Create a flea offer and store it in the Ragfair server offers array - * @param userID owner of the offer - * @param time time offer is put up - * @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 - * @returns Ragfair offer - */ - createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/types/generators/ScavCaseRewardGenerator.d.ts b/types/generators/ScavCaseRewardGenerator.d.ts index a7f4302..d40b4d2 100644 --- a/types/generators/ScavCaseRewardGenerator.d.ts +++ b/types/generators/ScavCaseRewardGenerator.d.ts @@ -1,5 +1,6 @@ import { ItemHelper } from "../helpers/ItemHelper"; import { Product } from "../models/eft/common/tables/IBotBase"; +import { Upd } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IHideoutScavCase } from "../models/eft/hideout/IHideoutScavCase"; import { IScavCaseConfig } from "../models/spt/config/IScavCaseConfig"; @@ -24,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 @@ -32,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 @@ -78,7 +81,7 @@ export declare class ScavCaseRewardGenerator { protected addStackCountToAmmoAndMoney(item: ITemplateItem, resultItem: { _id: string; _tpl: string; - upd: any; + upd: Upd; }, rarity: string): void; /** * diff --git a/types/generators/WeatherGenerator.d.ts b/types/generators/WeatherGenerator.d.ts index 65d2c76..6471bb1 100644 --- a/types/generators/WeatherGenerator.d.ts +++ b/types/generators/WeatherGenerator.d.ts @@ -16,6 +16,11 @@ export declare class WeatherGenerator { protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); + /** + * Get current + raid datetime and format into correct BSG format and return + * @param data Weather data + * @returns IWeatherData + */ calculateGameTime(data: IWeatherData): IWeatherData; /** * Get server uptime seconds multiplied by a multiplier and add to current time as seconds @@ -33,7 +38,7 @@ export declare class WeatherGenerator { /** * Get current time formatted to fit BSGs requirement * @param date date to format into bsg style - * @returns + * @returns Time formatted in BSG format */ protected getBSGFormattedTime(date: Date): string; /** @@ -47,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/AssortHelper.d.ts b/types/helpers/AssortHelper.d.ts index bc66b09..df674c5 100644 --- a/types/helpers/AssortHelper.d.ts +++ b/types/helpers/AssortHelper.d.ts @@ -14,12 +14,12 @@ export declare class AssortHelper { protected questHelper: QuestHelper; constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** - * Remove assorts from a trader that have not been unlocked yet - * @param pmcProfile player profile - * @param traderId traders id the assort belongs to + * Remove assorts from a trader that have not been unlocked yet (via player completing corrisponding quest) + * @param pmcProfile Player profile + * @param traderId Traders id the assort belongs to * @param traderAssorts All assort items from same trader - * @param mergedQuestAssorts Dict of quest assort to quest id unlocks for all traders - * @returns assort items minus locked quest assorts + * @param mergedQuestAssorts Dict of quest assort to quest id unlocks for all traders (key = started/failed/complete) + * @returns Assort items minus locked quest assorts */ stripLockedQuestAssort(pmcProfile: IPmcData, traderId: string, traderAssorts: ITraderAssort, mergedQuestAssorts: Record>, flea?: boolean): ITraderAssort; /** 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/ContainerHelper.d.ts b/types/helpers/ContainerHelper.d.ts index 3c2ee93..125fbcb 100644 --- a/types/helpers/ContainerHelper.d.ts +++ b/types/helpers/ContainerHelper.d.ts @@ -6,7 +6,35 @@ export declare class FindSlotResult { constructor(success?: boolean, x?: any, y?: any, rotation?: boolean); } export declare class ContainerHelper { - protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; + /** + * Finds a slot for an item in a given 2D container map + * @param container2D Array of container with slots filled/free + * @param itemWidth Width of item + * @param itemHeight Height of item + * @returns Location to place item in container + */ findSlotForItem(container2D: number[][], itemWidth: number, itemHeight: number): FindSlotResult; - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): any; + /** + * Find a slot inside a container an item can be placed in + * @param container2D Container to find space in + * @param containerX Container x size + * @param containerY Container y size + * @param x ??? + * @param y ??? + * @param itemW Items width + * @param itemH Items height + * @returns True - slot found + */ + protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; + /** + * Find a free slot for an item to be placed at + * @param container2D Container to palce item in + * @param x Container x size + * @param y Container y size + * @param itemW Items width + * @param itemH Items height + * @param rotate is item rotated + * @returns Location to place item + */ + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; } diff --git a/types/helpers/DialogueHelper.d.ts b/types/helpers/DialogueHelper.d.ts index 898bf8e..ea3bae7 100644 --- a/types/helpers/DialogueHelper.d.ts +++ b/types/helpers/DialogueHelper.d.ts @@ -20,21 +20,13 @@ export declare class DialogueHelper { protected itemHelper: ItemHelper; constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); /** - * Create basic message context template - * @param templateId - * @param messageType - * @param maxStoreTime - * @returns + * @deprecated Use MailSendService.sendMessage() or helpers */ - createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent; + createMessageContext(templateId: string, messageType: MessageType, maxStoreTime?: any): MessageContent; /** - * Add a templated message to the dialogue. - * @param dialogueID - * @param messageContent - * @param sessionID - * @param rewards + * @deprecated Use MailSendService.sendMessage() or helpers */ - addDialogueMessage(dialogueID: string, messageContent: MessageContent, sessionID: string, rewards?: Item[]): void; + addDialogueMessage(dialogueID: string, messageContent: MessageContent, sessionID: string, rewards?: Item[], messageType?: MessageType): void; /** * Get the preview contents of the last message in a dialogue. * @param dialogue @@ -49,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/DurabilityLimitsHelper.d.ts b/types/helpers/DurabilityLimitsHelper.d.ts index 7122376..671559f 100644 --- a/types/helpers/DurabilityLimitsHelper.d.ts +++ b/types/helpers/DurabilityLimitsHelper.d.ts @@ -9,9 +9,35 @@ export declare class DurabilityLimitsHelper { protected configServer: ConfigServer; protected botConfig: IBotConfig; constructor(randomUtil: RandomUtil, botHelper: BotHelper, configServer: ConfigServer); + /** + * Get max durability for a weapon based on bot role + * @param itemTemplate UNUSED - Item to get durability for + * @param botRole Role of bot to get max durability for + * @returns Max durability of weapon + */ getRandomizedMaxWeaponDurability(itemTemplate: ITemplateItem, botRole: string): number; + /** + * Get max durability value for armor based on bot role + * @param itemTemplate Item to get max durability for + * @param botRole Role of bot to get max durability for + * @returns max durability + */ getRandomizedMaxArmorDurability(itemTemplate: ITemplateItem, botRole: string): number; + /** + * Get randomised current weapon durability by bot role + * @param itemTemplate Unused - Item to get current durability of + * @param botRole Role of bot to get current durability for + * @param maxDurability Max durability of weapon + * @returns Current weapon durability + */ getRandomizedWeaponDurability(itemTemplate: ITemplateItem, botRole: string, maxDurability: number): number; + /** + * Get randomised current armor durability by bot role + * @param itemTemplate Unused - Item to get current durability of + * @param botRole Role of bot to get current durability for + * @param maxDurability Max durability of armor + * @returns Current armor durability + */ getRandomizedArmorDurability(itemTemplate: ITemplateItem, botRole: string, maxDurability: number): number; protected generateMaxWeaponDurability(botRole: string): number; protected generateMaxPmcArmorDurability(itemMaxDurability: number): number; diff --git a/types/helpers/HandbookHelper.d.ts b/types/helpers/HandbookHelper.d.ts index dd9ce09..856c23a 100644 --- a/types/helpers/HandbookHelper.d.ts +++ b/types/helpers/HandbookHelper.d.ts @@ -14,6 +14,9 @@ export declare class HandbookHelper { protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; constructor(databaseServer: DatabaseServer); + /** + * Create an in-memory cache of all items with associated handbook price in handbookPriceCache class + */ hydrateLookup(): void; /** * Get price from internal cache, if cache empty look up price directly in handbook (expensive) @@ -23,18 +26,23 @@ export declare class HandbookHelper { */ getTemplatePrice(tpl: string): number; /** - * all items in template with the given parent category - * @param x + * Get all items in template with the given parent category + * @param parentId * @returns string array */ - templatesWithParent(x: string): string[]; + templatesWithParent(parentId: string): string[]; /** * Does category exist in handbook cache * @param category * @returns true if exists in cache */ isCategory(category: string): boolean; - childrenCategories(x: string): string[]; + /** + * Get all items associated with a categories parent + * @param categoryParent + * @returns string array + */ + childrenCategories(categoryParent: string): string[]; /** * Convert non-roubles into roubles * @param nonRoubleCurrencyCount Currency count to convert diff --git a/types/helpers/HealthHelper.d.ts b/types/helpers/HealthHelper.d.ts index 7a6d41d..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; /** @@ -53,5 +54,7 @@ export declare class HealthHelper { * @param duration How long the effect has left in seconds (-1 by default, no duration). */ protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: string, duration?: number): void; - protected isEmpty(map: any): boolean; + protected isEmpty(map: Record): boolean; } diff --git a/types/helpers/HideoutHelper.d.ts b/types/helpers/HideoutHelper.d.ts index c718865..80ac27c 100644 --- a/types/helpers/HideoutHelper.d.ts +++ b/types/helpers/HideoutHelper.d.ts @@ -51,18 +51,19 @@ export declare class HideoutHelper { * This convenience function initializes new Production Object * with all the constants. */ - initProduction(recipeId: string, productionTime: number): Production; - isProductionType(productive: Productive): productive is Production; - applyPlayerUpgradesBonuses(pmcData: IPmcData, bonus: StageBonus): void; + initProduction(recipeId: string, productionTime: number, needFuelForAllProductionTime: boolean): Production; /** - * 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 + * Is the provided object a Production type + * @param productive + * @returns */ - protected applySkillXPBoost(pmcData: IPmcData, bonus: StageBonus): void; + isProductionType(productive: Productive): productive is Production; + /** + * Apply bonus to player profile given after completing hideout upgrades + * @param pmcData Profile to add bonus to + * @param bonus Bonus to add to profile + */ + applyPlayerUpgradesBonuses(pmcData: IPmcData, bonus: StageBonus): void; /** * Process a players hideout, update areas that use resources + increment production timers * @param sessionID Session id @@ -78,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 @@ -136,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 @@ -148,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 @@ -159,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 @@ -180,38 +191,39 @@ 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 * @returns coin slot count */ protected getBTCSlots(pmcData: IPmcData): number; - /** - * Get a count of bitcoins player miner can hold - */ - protected getManagementSkillsSlots(): number; /** * Does profile have elite hideout management skill * @param pmcData Profile to look at * @returns True if profile has skill */ protected hasEliteHideoutManagementSkill(pmcData: IPmcData): boolean; + /** + * Get a count of bitcoins player miner can hold + */ + protected getBitcoinMinerContainerSlotSize(): number; /** * Get the hideout management skill from player profile * @param pmcData Profile to look at * @returns Hideout management skill object */ protected getHideoutManagementSkill(pmcData: IPmcData): Common; - protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; /** - * Get the crafting skill details from player profile - * @param pmcData Player profile - * @returns crafting skill, null if not found + * 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 getCraftingSkill(pmcData: IPmcData): Common; + protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; /** * Adjust craft time based on crafting skill level found in player profile * @param pmcData Player profile @@ -236,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/HttpServerHelper.d.ts b/types/helpers/HttpServerHelper.d.ts index c6e5296..b05cbdf 100644 --- a/types/helpers/HttpServerHelper.d.ts +++ b/types/helpers/HttpServerHelper.d.ts @@ -16,8 +16,17 @@ export declare class HttpServerHelper { }; constructor(configServer: ConfigServer); getMimeText(key: string): string; + /** + * Combine ip and port into url + * @returns url + */ buildUrl(): string; + /** + * Prepend http to the url:port + * @returns URI + */ getBackendUrl(): string; + /** Get websocket url + port */ getWebsocketUrl(): string; sendTextJson(resp: any, output: any): void; } diff --git a/types/helpers/InRaidHelper.d.ts b/types/helpers/InRaidHelper.d.ts index 0de950c..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); /** - * Should quest items be removed from player inventory on death + * 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,12 +65,27 @@ 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 * @param saveProgressRequest post-raid request * @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 @@ -79,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 a2ee699..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; @@ -53,11 +57,23 @@ export declare class InventoryHelper { * @param callback Code to execute later (function) * @param foundInRaid Will results added to inventory be set as found in raid * @param addUpd Additional upd properties for items being added to inventory + * @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): 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 @@ -65,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 @@ -75,23 +93,31 @@ export declare class InventoryHelper { */ protected splitStackIntoSmallerStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void; /** - * Remove item from player inventory - * @param pmcData Profile to remove item from + * Handle Remove event + * Remove item from player inventory + insured items array + * 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 @@ -99,19 +125,37 @@ export declare class InventoryHelper { * @returns Array */ protected getStashSlotMap(pmcData: IPmcData, sessionID: string): number[][]; - protected getStashType(sessionID: string): string; + 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; /** - * 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 - */ + * 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. + * @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 @@ -128,6 +172,7 @@ export declare class InventoryHelper { * @returns Reward details */ getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; + getInventoryConfig(): IInventoryConfig; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/types/helpers/ItemHelper.d.ts b/types/helpers/ItemHelper.d.ts index 98fe95e..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 @@ -51,11 +52,34 @@ declare class ItemHelper { /** * 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 {string} tpl the item template to check - * @returns {integer} The price of the item or 0 if not found + * @param tpl Item to look price up of + * @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 + * @returns Price in roubles (0 if not found) + */ + getStaticItemPrice(tpl: string): number; + /** + * Get the dynamic (flea) price in roubles for an item by tpl + * @param tpl Items tpl id to look up price + * @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. @@ -114,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 @@ -153,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 @@ -172,28 +190,28 @@ 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[]; /** - * - * @param pmcData - * @param items + * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) + * @param pmcData Player profile + * @param items Items to adjust ID values of * @param insuredItems insured items to not replace ids for * @param fastPanel - * @returns + * @returns Item[] */ - replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): any[]; + replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): Item[]; /** * WARNING, SLOW. Recursively loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do * @param {string} tpl Items tpl to check parents of @@ -226,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 @@ -243,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/NotifierHelper.d.ts b/types/helpers/NotifierHelper.d.ts index 738b69a..d824fb2 100644 --- a/types/helpers/NotifierHelper.d.ts +++ b/types/helpers/NotifierHelper.d.ts @@ -9,9 +9,18 @@ export declare class NotifierHelper { protected defaultNotification: INotification; constructor(httpServerHelper: HttpServerHelper); getDefaultNotification(): INotification; - /** Creates a new notification that displays the "Your offer was sold!" prompt and removes sold offer from "My Offers" on clientside */ + /** + * Create a new notification that displays the "Your offer was sold!" prompt and removes sold offer from "My Offers" on clientside + * @param dialogueMessage Message from dialog that was sent + * @param ragfairData Ragfair data to attach to notification + * @returns + */ createRagfairOfferSoldNotification(dialogueMessage: Message, ragfairData: MessageContentRagfair): INotification; - /** Creates a new notification with the specified dialogueMessage object. */ + /** + * Create a new notification with the specified dialogueMessage object + * @param dialogueMessage + * @returns + */ createNewMessageNotification(dialogueMessage: Message): INotification; getWebSocketServer(sessionID: string): string; } diff --git a/types/helpers/PresetHelper.d.ts b/types/helpers/PresetHelper.d.ts index cea210e..e50cae8 100644 --- a/types/helpers/PresetHelper.d.ts +++ b/types/helpers/PresetHelper.d.ts @@ -1,18 +1,23 @@ -import { Preset } from "../models/eft/common/IGlobals"; +import { IPreset } from "../models/eft/common/IGlobals"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected lookup: Record; - protected defaultPresets: Record; + protected defaultPresets: Record; constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); hydratePresetStore(input: Record): void; - getDefaultPresets(): Record; + getDefaultPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; - getPreset(id: string): Preset; - getPresets(templateId: string): Preset[]; - getDefaultPreset(templateId: string): Preset; + 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 91e71ae..3c33ae7 100644 --- a/types/helpers/ProfileHelper.d.ts +++ b/types/helpers/ProfileHelper.d.ts @@ -1,5 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; -import { Stats } from "../models/eft/common/tables/IBotBase"; +import { CounterKeyValue, Stats } from "../models/eft/common/tables/IBotBase"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -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 @@ -68,6 +68,10 @@ export declare class ProfileHelper { getFullProfile(sessionID: string): IAkiProfile; getPmcProfile(sessionID: string): IPmcData; getScavProfile(sessionID: string): IPmcData; + /** + * Get baseline counter values for a fresh profile + * @returns Stats + */ getDefaultCounters(): Stats; protected isWiped(sessionID: string): boolean; protected getServerVersion(): string; @@ -77,4 +81,24 @@ export declare class ProfileHelper { * @returns profile without secure container */ removeSecureContainer(profile: IPmcData): IPmcData; + /** + * Flag a profile as having received a gift + * Store giftid in profile aki object + * @param playerId Player to add gift flag to + * @param giftId Gift player received + */ + addGiftReceivedFlagToProfile(playerId: string, giftId: string): void; + /** + * Check if profile has recieved a gift by id + * @param playerId Player profile to check for gift + * @param giftId Gift to check for + * @returns True if player has recieved gift previously + */ + playerHasRecievedGift(playerId: string, giftId: string): boolean; + /** + * Find Stat in profile counters and increment by one + * @param counters Counters to search for key + * @param keyToIncrement Key + */ + incrementStatCounter(counters: CounterKeyValue[], keyToIncrement: string): void; } 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 dcfc5ae..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"; @@ -13,6 +13,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; import { LocalisationService } from "../services/LocalisationService"; +import { MailSendService } from "../services/MailSendService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -20,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 { @@ -28,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; @@ -37,9 +40,10 @@ export declare class QuestHelper { protected paymentHelper: PaymentHelper; protected localisationService: LocalisationService; protected traderHelper: TraderHelper; + 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, 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 @@ -63,6 +67,7 @@ export declare class QuestHelper { getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; /** * Increase skill points of a skill on player profile + * Dupe of PlayerService.incrementSkillLevel() * @param sessionID Session id * @param pmcData Player profile * @param skillName Name of skill to increase skill points of @@ -81,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 @@ -101,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 @@ -157,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 @@ -214,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 41e5f85..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"; @@ -12,10 +13,11 @@ import { ConfigServer } from "../servers/ConfigServer"; 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"; @@ -32,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; @@ -42,15 +43,17 @@ export declare class RagfairOfferHelper { protected ragfairHelper: RagfairHelper; 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, 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 @@ -65,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 @@ -110,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/RagfairServerHelper.d.ts b/types/helpers/RagfairServerHelper.d.ts index bfe6cc3..3d73605 100644 --- a/types/helpers/RagfairServerHelper.d.ts +++ b/types/helpers/RagfairServerHelper.d.ts @@ -8,41 +8,67 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocaleService } from "../services/LocaleService"; +import { MailSendService } from "../services/MailSendService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { TraderHelper } from "./TraderHelper"; /** * Helper class for common ragfair server actions */ export declare class RagfairServerHelper { protected randomUtil: RandomUtil; protected hashUtil: HashUtil; + protected timeUtil: TimeUtil; protected saveServer: SaveServer; protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected itemHelper: ItemHelper; protected localeService: LocaleService; protected dialogueHelper: DialogueHelper; + protected traderHelper: TraderHelper; protected jsonUtil: JsonUtil; + protected mailSendService: MailSendService; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; protected static goodsReturnedTemplate: string; - constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(randomUtil: RandomUtil, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, mailSendService: MailSendService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Is item valid / on blacklist / quest item * @param itemDetails * @returns boolean */ isItemValidRagfairItem(itemDetails: [boolean, ITemplateItem]): boolean; - protected isItemBlacklisted(itemTemplateId: string): boolean; - isTrader(userID: string): boolean; - isPlayer(userID: string): boolean; - returnItems(sessionID: string, items: Item[]): void; + /** + * Is supplied item tpl on the ragfair custom blacklist from configs/ragfair.json/dynamic + * @param itemTemplateId Item tpl to check is blacklisted + * @returns True if its blacklsited + */ + protected isItemOnCustomFleaBlacklist(itemTemplateId: string): boolean; + /** + * is supplied id a trader + * @param traderId + * @returns True if id was a trader + */ + isTrader(traderId: string): boolean; + /** + * Is this user id the logged in player + * @param userId Id to test + * @returns True is the current player + */ + isPlayer(userId: string): boolean; + /** + * Send items back to player + * @param sessionID Player to send items to + * @param returnedItems Items to send to player + */ + returnItems(sessionID: string, returnedItems: Item[]): void; calculateDynamicStackCount(tplId: string, isWeaponPreset: boolean): number; /** * Choose a currency at random with bias 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 bef1511..7eb4edf 100644 --- a/types/helpers/TraderHelper.d.ts +++ b/types/helpers/TraderHelper.d.ts @@ -1,5 +1,8 @@ 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"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -33,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 @@ -41,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 @@ -64,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 @@ -106,4 +122,37 @@ export declare class TraderHelper { * @returns Rouble price */ getHighestSellToTraderPrice(tpl: string): number; + /** + * Get a trader enum key by its value + * @param traderId Traders id + * @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/BundleLoader.d.ts b/types/loaders/BundleLoader.d.ts index 4c7e9d6..e043b39 100644 --- a/types/loaders/BundleLoader.d.ts +++ b/types/loaders/BundleLoader.d.ts @@ -15,6 +15,9 @@ export declare class BundleLoader { protected jsonUtil: JsonUtil; protected bundles: Record; constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil); + /** + * Handle singleplayer/bundles + */ getBundles(local: boolean): BundleInfo[]; getBundle(key: string, local: boolean): BundleInfo; addBundles(modpath: string): void; diff --git a/types/loaders/PreAkiModLoader.d.ts b/types/loaders/PreAkiModLoader.d.ts index 1949696..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,9 +37,10 @@ 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 duplciate mods loaded, show error if duplicate mod found - * @param modPackageData dictionary of mod package.json data + * Check for duplicate mods loaded, show error if any + * @param modPackageData Dictionary of mod package.json data */ protected checkForDuplicateMods(modPackageData: Record): void; /** @@ -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 f1845f6..c774511 100644 --- a/types/models/eft/common/IGlobals.d.ts +++ b/types/models/eft/common/IGlobals.d.ts @@ -1,20 +1,22 @@ +import { Ixyz } from "./Ixyz"; import { Item } from "./tables/IItem"; export interface IGlobals { time: number; - config: Config; - bot_presets: BotPreset[]; - BotWeaponScatterings: BotWeaponScattering[]; - ItemPresets: Record; + config: IConfig; + bot_presets: IBotPreset[]; + AudioSettings: IAudioSettings; + BotWeaponScatterings: IBotWeaponScattering[]; + ItemPresets: Record; } -export interface Config { - content: Content; +export interface IConfig { + content: IContent; AimPunchMagnitude: number; WeaponSkillProgressRate: number; SkillAtrophy: boolean; - exp: Exp; + exp: IExp; t_base_looting: number; t_base_lockpicking: number; - armor: Armor; + armor: IArmor; SessionsToShowHotKeys: number; MaxBotsAliveOnMap: number; SavagePlayCooldown: number; @@ -22,11 +24,12 @@ export interface Config { MarksmanAccuracy: number; SavagePlayCooldownDevelop: number; TODSkyDate: string; - Mastering: Mastering[]; + Mastering: IMastering[]; GlobalItemPriceModifier: number; TradingUnlimitedItems: boolean; MaxLoyaltyLevelForAll: boolean; GlobalLootChanceModifier: number; + GraphicSettings: IGraphicSettings; TimeBeforeDeploy: number; TimeBeforeDeployLocal: number; TradingSetting: number; @@ -36,30 +39,30 @@ export interface Config { BaseLoadTime: number; BaseUnloadTime: number; BaseCheckTime: number; - Customization: Customization; + Customization: ICustomization; UncheckOnShot: boolean; BotsEnabled: boolean; BufferZone: IBufferZone; - ArmorMaterials: ArmorMaterials; + ArmorMaterials: IArmorMaterials; LegsOverdamage: number; HandsOverdamage: number; StomachOverdamage: number; - Health: Health; - rating: Rating; - tournament: Tournament; - RagFair: RagFair; - handbook: Handbook; - FractureCausedByFalling: Probability; - FractureCausedByBulletHit: Probability; + Health: IHealth; + rating: IRating; + tournament: ITournament; + RagFair: IRagFair; + handbook: IHandbook; + FractureCausedByFalling: IProbability; + FractureCausedByBulletHit: IProbability; WAVE_COEF_LOW: number; WAVE_COEF_MID: number; WAVE_COEF_HIGH: number; WAVE_COEF_HORDE: number; - Stamina: Stamina; - StaminaRestoration: StaminaRestoration; - StaminaDrain: StaminaDrain; - RequirementReferences: RequirementReferences; - RestrictionsInRaid: RestrictionsInRaid[]; + Stamina: IStamina; + StaminaRestoration: IStaminaRestoration; + StaminaDrain: IStaminaDrain; + RequirementReferences: IRequirementReferences; + RestrictionsInRaid: IRestrictionsInRaid[]; SkillMinEffectiveness: number; SkillFatiguePerPoint: number; SkillFreshEffectiveness: number; @@ -68,25 +71,39 @@ export interface Config { SkillFatigueReset: number; DiscardLimitsEnabled: boolean; EventType: string[]; - WalkSpeed: xyz; - SprintSpeed: xyz; + WalkSpeed: Ixyz; + SprintSpeed: Ixyz; SquadSettings: ISquadSettings; SkillEnduranceWeightThreshold: number; TeamSearchingTimeout: number; - Insurance: Insurance; + Insurance: IInsurance; SkillExpPerLevel: number; GameSearchingTimeout: number; - WallContusionAbsorption: xyz; - SkillsSettings: SkillsSettings; + WallContusionAbsorption: Ixyz; + WeaponFastDrawSettings: IWeaponFastDrawSettings; + SkillsSettings: ISkillsSettings; AzimuthPanelShowsPlayerOrientation: boolean; - Aiming: Aiming; - Malfunction: Malfunction; - Overheat: Overheat; - FenceSettings: FenceSettings; + Aiming: IAiming; + Malfunction: IMalfunction; + Overheat: IOverheat; + FenceSettings: IFenceSettings; TestValue: number; - Inertia: Inertia; - Ballistic: Ballistic; - RepairSettings: RepairSettings; + Inertia: IInertia; + 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; @@ -104,27 +121,27 @@ export interface IBuyoutRestrictions { MinFoodDrinkResource: number; MinMedsResource: number; } -export interface Content { +export interface IContent { ip: string; port: number; root: string; } -export interface Exp { - heal: Heal; - match_end: MatchEnd; - kill: Kill; - level: Level; - loot_attempts: LootAttempt[]; +export interface IExp { + heal: IHeal; + match_end: IMatchEnd; + kill: IKill; + level: ILevel; + loot_attempts: ILootAttempt[]; expForLockedDoorOpen: number; expForLockedDoorBreach: number; triggerMult: number; } -export interface Heal { +export interface IHeal { expForHeal: number; expForHydration: number; expForEnergy: number; } -export interface MatchEnd { +export interface IMatchEnd { README: string; survived_exp_requirement: number; survived_seconds_requirement: number; @@ -137,175 +154,179 @@ export interface MatchEnd { runnerMult: number; killedMult: number; } -export interface Kill { - combo: Combo[]; +export interface IKill { + combo: ICombo[]; victimLevelExp: number; headShotMult: number; expOnDamageAllHealth: number; longShotDistance: number; bloodLossToLitre: number; + botExpOnDamageAllHealth: number; + botHeadShotMult: number; victimBotLevelExp: number; + pmcExpOnDamageAllHealth: number; + pmcHeadShotMult: number; } -export interface Combo { +export interface ICombo { percent: number; } -export interface Level { - exp_table: ExpTable[]; +export interface ILevel { + exp_table: IExpTable[]; trade_level: number; savage_level: number; clan_level: number; mastering1: number; mastering2: number; } -export interface ExpTable { +export interface IExpTable { exp: number; } -export interface LootAttempt { +export interface ILootAttempt { k_exp: number; } -export interface Armor { - class: Class[]; +export interface IArmor { + class: IClass[]; } -export interface Class { +export interface IClass { resistance: number; } -export interface Mastering { +export interface IMastering { Name: string; Templates: string[]; Level2: number; Level3: number; } -export interface Customization { - SavageHead: SavageHead; - SavageBody: SavageBody; - SavageFeet: SavageFeet; - CustomizationVoice: CustomizationVoice[]; - BodyParts: BodyParts; +export interface ICustomization { + SavageHead: ISavageHead; + SavageBody: ISavageBody; + SavageFeet: ISavageFeet; + CustomizationVoice: ICustomizationVoice[]; + BodyParts: IBodyParts; } -export interface SavageHead { - wild_head_1: WildHead; - wild_head_2: WildHead; - wild_head_3: WildHead; - Wild_Dealmaker_head: WildHead; - Wild_Killa_head: WildHead; - bear_head: WildHead; - bear_head_1: WildHead; - usec_head_1: WildHead; - Head_BOSS_Glukhar: WildHead; - Wild_Head_nonMesh: WildHead; - Head_BOSS_Sanitar: WildHead; - wild_head_drozd: WildHead; - wild_head_misha: WildHead; - head_cultist_01: WildHead; - head_cultist_02: WildHead; - head_cultist_03: WildHead; - DefaultUsecHead: WildHead; - usec_head_3: WildHead; - usec_head_4: WildHead; - usec_head_5: WildHead; +export interface ISavageHead { + wild_head_1: IWildHead; + wild_head_2: IWildHead; + wild_head_3: IWildHead; + Wild_Dealmaker_head: IWildHead; + Wild_Killa_head: IWildHead; + bear_head: IWildHead; + bear_head_1: IWildHead; + usec_head_1: IWildHead; + Head_BOSS_Glukhar: IWildHead; + Wild_Head_nonMesh: IWildHead; + Head_BOSS_Sanitar: IWildHead; + wild_head_drozd: IWildHead; + wild_head_misha: IWildHead; + head_cultist_01: IWildHead; + head_cultist_02: IWildHead; + head_cultist_03: IWildHead; + DefaultUsecHead: IWildHead; + usec_head_3: IWildHead; + usec_head_4: IWildHead; + usec_head_5: IWildHead; } -export interface WildHead { +export interface IWildHead { head: string; isNotRandom: boolean; NotRandom: boolean; } -export interface SavageBody { - wild_body: WildBody; - wild_body_1: WildBody; - wild_body_2: WildBody; - wild_body_3: WildBody; - Wild_Dealmaker_body: WildBody; - wild_security_body_1: WildBody; - wild_security_body_2: WildBody; - wild_Killa_body: WildBody; - wild_pmcBot_body: WildBody; - wild_Shturman_body: WildBody; - wild_Gluhar_body: WildBody; - Tshirt_security_TshirtTatu_01: WildBody; - Tshirt_security_TshirtTatu_02: WildBody; - Top_security_Husky: WildBody; - Top_security_Gorka4: WildBody; - scav_kit_upper_meteor: WildBody; - wild_body_russia1: WildBody; - Top_BOSS_Sanitar: WildBody; - wild_body_motocross: WildBody; - top_cultist_01: WildBody; - top_cultist_02: WildBody; - wild_body_rainparka: WildBody; - wild_body_underarmour: WildBody; - top_boss_tagilla: WildBody; - DefaultUsecBody: WildBody; - usec_upper_acu: WildBody; - usec_upper_commando: WildBody; - usec_upper_aggressor: WildBody; - usec_upper_hoody: WildBody; - usec_upper_pcuironsight: WildBody; - usec_top_beltstaff: WildBody; - usec_upper_flexion: WildBody; - usec_upper_tier3: WildBody; - usec_upper_pcsmulticam: WildBody; - usec_upper_tier_2: WildBody; - usec_upper_infiltrator: WildBody; - user_upper_NightPatrol: WildBody; - wild_body_bomber: WildBody; - wild_top_yellowcoat: WildBody; +export interface ISavageBody { + wild_body: IWildBody; + wild_body_1: IWildBody; + wild_body_2: IWildBody; + wild_body_3: IWildBody; + Wild_Dealmaker_body: IWildBody; + wild_security_body_1: IWildBody; + wild_security_body_2: IWildBody; + wild_Killa_body: IWildBody; + wild_pmcBot_body: IWildBody; + wild_Shturman_body: IWildBody; + wild_Gluhar_body: IWildBody; + Tshirt_security_TshirtTatu_01: IWildBody; + Tshirt_security_TshirtTatu_02: IWildBody; + Top_security_Husky: IWildBody; + Top_security_Gorka4: IWildBody; + scav_kit_upper_meteor: IWildBody; + wild_body_russia1: IWildBody; + Top_BOSS_Sanitar: IWildBody; + wild_body_motocross: IWildBody; + top_cultist_01: IWildBody; + top_cultist_02: IWildBody; + wild_body_rainparka: IWildBody; + wild_body_underarmour: IWildBody; + top_boss_tagilla: IWildBody; + DefaultUsecBody: IWildBody; + usec_upper_acu: IWildBody; + usec_upper_commando: IWildBody; + usec_upper_aggressor: IWildBody; + usec_upper_hoody: IWildBody; + usec_upper_pcuironsight: IWildBody; + usec_top_beltstaff: IWildBody; + usec_upper_flexion: IWildBody; + usec_upper_tier3: IWildBody; + usec_upper_pcsmulticam: IWildBody; + usec_upper_tier_2: IWildBody; + usec_upper_infiltrator: IWildBody; + user_upper_NightPatrol: IWildBody; + wild_body_bomber: IWildBody; + wild_top_yellowcoat: IWildBody; } -export interface WildBody { +export interface IWildBody { body: string; hands: string; isNotRandom: boolean; } -export interface SavageFeet { - wild_feet: WildFeet; - wild_feet_1: WildFeet; - wild_feet_2: WildFeet; - Wild_Dealmaker_feet: WildFeet; - wild_security_feet_1: WildFeet; - Wild_Killa_feet: WildFeet; - wild_pmcBot_feet: WildFeet; - Pants_BOSS_Glukhar: WildFeet; - Pants_BOSS_Shturman: WildFeet; - Pants_security_Gorka4: WildFeet; - Pants_security_Flora: WildFeet; - scav_kit_lower_sklon: WildFeet; - Pants_BOSS_Sanitar: WildFeet; - wild_feet_sweatpants: WildFeet; - wild_feet_wasatch: WildFeet; - wild_feet_slimPants: WildFeet; - pants_cultist_01: WildFeet; - pants_cultist_02: WildFeet; - wild_feet_scavelite_taclite: WildFeet; - pants_boss_tagilla: WildFeet; - wild_feet_bomber: WildFeet; - wild_pants_yellowcoat: WildFeet; +export interface ISavageFeet { + wild_feet: IWildFeet; + wild_feet_1: IWildFeet; + wild_feet_2: IWildFeet; + Wild_Dealmaker_feet: IWildFeet; + wild_security_feet_1: IWildFeet; + Wild_Killa_feet: IWildFeet; + wild_pmcBot_feet: IWildFeet; + Pants_BOSS_Glukhar: IWildFeet; + Pants_BOSS_Shturman: IWildFeet; + Pants_security_Gorka4: IWildFeet; + Pants_security_Flora: IWildFeet; + scav_kit_lower_sklon: IWildFeet; + Pants_BOSS_Sanitar: IWildFeet; + wild_feet_sweatpants: IWildFeet; + wild_feet_wasatch: IWildFeet; + wild_feet_slimPants: IWildFeet; + pants_cultist_01: IWildFeet; + pants_cultist_02: IWildFeet; + wild_feet_scavelite_taclite: IWildFeet; + pants_boss_tagilla: IWildFeet; + wild_feet_bomber: IWildFeet; + wild_pants_yellowcoat: IWildFeet; } -export interface WildFeet { +export interface IWildFeet { feet: string; isNotRandom: boolean; NotRandom: boolean; } -export interface CustomizationVoice { +export interface ICustomizationVoice { voice: string; side: string[]; isNotRandom: boolean; } -export interface BodyParts { +export interface IBodyParts { Head: string; Body: string; Feet: string; Hands: string; } -export interface ArmorMaterials { - UHMWPE: ArmorType; - Aramid: ArmorType; - Combined: ArmorType; - Titan: ArmorType; - Aluminium: ArmorType; - ArmoredSteel: ArmorType; - Ceramic: ArmorType; - Glass: ArmorType; +export interface IArmorMaterials { + UHMWPE: IArmorType; + Aramid: IArmorType; + Combined: IArmorType; + Titan: IArmorType; + Aluminium: IArmorType; + ArmoredSteel: IArmorType; + Ceramic: IArmorType; + Glass: IArmorType; } -export interface ArmorType { +export interface IArmorType { Destructibility: number; MinRepairDegradation: number; MaxRepairDegradation: number; @@ -313,46 +334,46 @@ export interface ArmorType { MinRepairKitDegradation: number; MaxRepairKitDegradation: number; } -export interface Health { - Falling: Falling; - Effects: Effects; - HealPrice: HealPrice; - ProfileHealthSettings: ProfileHealthSettings; +export interface IHealth { + Falling: IFalling; + Effects: IEffects; + HealPrice: IHealPrice; + ProfileHealthSettings: IProfileHealthSettings; } -export interface Falling { +export interface IFalling { DamagePerMeter: number; SafeHeight: number; } -export interface Effects { - Existence: Existence; - Dehydration: Dehydration; - BreakPart: BreakPart; - Contusion: Contusion; - Disorientation: Disorientation; - Exhaustion: Exhaustion; - LowEdgeHealth: LowEdgeHealth; - RadExposure: RadExposure; - Stun: Stun; +export interface IEffects { + Existence: IExistence; + Dehydration: IDehydration; + BreakPart: IBreakPart; + Contusion: IContusion; + Disorientation: IDisorientation; + Exhaustion: IExhaustion; + LowEdgeHealth: ILowEdgeHealth; + RadExposure: IRadExposure; + Stun: IStun; Intoxication: Intoxication; - Regeneration: Regeneration; - Wound: Wound; - Berserk: Berserk; - Flash: Flash; - MedEffect: MedEffect; - Pain: Pain; - PainKiller: PainKiller; - SandingScreen: SandingScreen; + Regeneration: IRegeneration; + Wound: IWound; + Berserk: IBerserk; + Flash: IFlash; + MedEffect: IMedEffect; + Pain: IPain; + PainKiller: IPainKiller; + SandingScreen: ISandingScreen; MildMusclePain: IMusclePainEffect; SevereMusclePain: IMusclePainEffect; - Stimulator: Stimulator; - Tremor: Tremor; - ChronicStaminaFatigue: ChronicStaminaFatigue; - Fracture: Fracture2; - HeavyBleeding: HeavyBleeding2; - LightBleeding: LightBleeding2; - BodyTemperature: BodyTemperature; + Stimulator: IStimulator; + Tremor: ITremor; + ChronicStaminaFatigue: IChronicStaminaFatigue; + Fracture: IFracture; + HeavyBleeding: IHeavyBleeding; + LightBleeding: ILightBleeding; + BodyTemperature: IBodyTemperature; } -export interface Existence { +export interface IExistence { EnergyLoopTime: number; HydrationLoopTime: number; EnergyDamage: number; @@ -360,7 +381,7 @@ export interface Existence { DestroyedStomachEnergyTimeFactor: number; DestroyedStomachHydrationTimeFactor: number; } -export interface Dehydration { +export interface IDehydration { DefaultDelay: number; DefaultResidueTime: number; BleedingHealth: number; @@ -369,7 +390,7 @@ export interface Dehydration { DamageOnStrongDehydration: number; StrongDehydrationLoopTime: number; } -export interface BreakPart { +export interface IBreakPart { DefaultDelay: number; DefaultResidueTime: number; HealExperience: number; @@ -377,31 +398,31 @@ export interface BreakPart { OfflineDurationMax: number; RemovePrice: number; RemovedAfterDeath: boolean; - BulletHitProbability: Probability; - FallingProbability: Probability; + BulletHitProbability: IProbability; + FallingProbability: IProbability; } -export interface Contusion { +export interface IContusion { Dummy: number; } -export interface Disorientation { +export interface IDisorientation { Dummy: number; } -export interface Exhaustion { +export interface IExhaustion { DefaultDelay: number; DefaultResidueTime: number; Damage: number; DamageLoopTime: number; } -export interface LowEdgeHealth { +export interface ILowEdgeHealth { DefaultDelay: number; DefaultResidueTime: number; StartCommonHealth: number; } -export interface RadExposure { +export interface IRadExposure { Damage: number; DamageLoopTime: number; } -export interface Stun { +export interface IStun { Dummy: number; } export interface Intoxication { @@ -415,52 +436,52 @@ export interface Intoxication { HealExperience: number; RemovePrice: number; } -export interface Regeneration { +export interface IRegeneration { LoopTime: number; MinimumHealthPercentage: number; Energy: number; Hydration: number; - BodyHealth: BodyHealth; - Influences: Influences; + BodyHealth: IBodyHealth; + Influences: IInfluences; } -export interface BodyHealth { - Head: BodyHealthValue; - Chest: BodyHealthValue; - Stomach: BodyHealthValue; - LeftArm: BodyHealthValue; - RightArm: BodyHealthValue; - LeftLeg: BodyHealthValue; - RightLeg: BodyHealthValue; +export interface IBodyHealth { + Head: IBodyHealthValue; + Chest: IBodyHealthValue; + Stomach: IBodyHealthValue; + LeftArm: IBodyHealthValue; + RightArm: IBodyHealthValue; + LeftLeg: IBodyHealthValue; + RightLeg: IBodyHealthValue; } -export interface BodyHealthValue { +export interface IBodyHealthValue { Value: number; } -export interface Influences { - LightBleeding: Influence; - HeavyBleeding: Influence; - Fracture: Influence; - RadExposure: Influence; - Intoxication: Influence; +export interface IInfluences { + LightBleeding: IInfluence; + HeavyBleeding: IInfluence; + Fracture: IInfluence; + RadExposure: IInfluence; + Intoxication: IInfluence; } -export interface Influence { +export interface IInfluence { HealthSlowDownPercentage: number; EnergySlowDownPercentage: number; HydrationSlowDownPercentage: number; } -export interface Wound { +export interface IWound { WorkingTime: number; ThresholdMin: number; ThresholdMax: number; } -export interface Berserk { +export interface IBerserk { DefaultDelay: number; WorkingTime: number; DefaultResidueTime: number; } -export interface Flash { +export interface IFlash { Dummy: number; } -export interface MedEffect { +export interface IMedEffect { LoopTime: number; StartDelay: number; DrinkStartDelay: number; @@ -470,14 +491,14 @@ export interface MedEffect { MedicalStartDelay: number; StimulatorStartDelay: number; } -export interface Pain { +export interface IPain { TremorDelay: number; HealExperience: number; } -export interface PainKiller { +export interface IPainKiller { Dummy: number; } -export interface SandingScreen { +export interface ISandingScreen { Dummy: number; } export interface IMusclePainEffect { @@ -486,54 +507,54 @@ export interface IMusclePainEffect { OfflineDurationMin: number; TraumaChance: number; } -export interface Stimulator { +export interface IStimulator { BuffLoopTime: number; - Buffs: Buffs; + Buffs: IBuffs; } -export interface Buffs { - BuffsSJ1TGLabs: Buff[]; - BuffsSJ6TGLabs: Buff[]; - BuffsPropital: Buff[]; - BuffsZagustin: Buff[]; - BuffseTGchange: Buff[]; - BuffsAdrenaline: Buff[]; - BuffsGoldenStarBalm: Buff[]; - Buffs_drink_aquamari: Buff[]; - Buffs_drink_maxenergy: Buff[]; - Buffs_drink_milk: Buff[]; - Buffs_drink_tarcola: Buff[]; - Buffs_drink_hotrod: Buff[]; - Buffs_drink_juice_army: Buff[]; - Buffs_drink_water: Buff[]; - Buffs_food_borodinskiye: Buff[]; - Buffs_food_condensed_milk: Buff[]; - Buffs_food_emelya: Buff[]; - Buffs_food_mayonez: Buff[]; - Buffs_food_mre: Buff[]; - Buffs_food_sugar: Buff[]; - Buffs_drink_vodka: Buff[]; - Buffs_drink_jack: Buff[]; - Buffs_drink_moonshine: Buff[]; - Buffs_drink_purewater: Buff[]; - Buffs_3bTG: Buff[]; - Buffs_AHF1M: Buff[]; - Buffs_L1: Buff[]; - Buffs_MULE: Buff[]; - Buffs_Meldonin: Buff[]; - Buffs_Obdolbos: Buff[]; - Buffs_P22: Buff[]; - Buffs_KultistsToxin: Buff[]; - Buffs_BodyTemperature: Buff[]; - Buffs_Antidote: Buff[]; - Buffs_melee_bleed: Buff[]; - Buffs_melee_blunt: Buff[]; - Buffs_hultafors: Buff[]; - Buffs_drink_vodka_BAD: Buff[]; - Buffs_food_alyonka: Buff[]; - Buffs_food_slippers: Buff[]; - Buffs_knife: Buff[]; +export interface IBuffs { + BuffsSJ1TGLabs: IBuff[]; + BuffsSJ6TGLabs: IBuff[]; + BuffsPropital: IBuff[]; + BuffsZagustin: IBuff[]; + BuffseTGchange: IBuff[]; + BuffsAdrenaline: IBuff[]; + BuffsGoldenStarBalm: IBuff[]; + Buffs_drink_aquamari: IBuff[]; + Buffs_drink_maxenergy: IBuff[]; + Buffs_drink_milk: IBuff[]; + Buffs_drink_tarcola: IBuff[]; + Buffs_drink_hotrod: IBuff[]; + Buffs_drink_juice_army: IBuff[]; + Buffs_drink_water: IBuff[]; + Buffs_food_borodinskiye: IBuff[]; + Buffs_food_condensed_milk: IBuff[]; + Buffs_food_emelya: IBuff[]; + Buffs_food_mayonez: IBuff[]; + Buffs_food_mre: IBuff[]; + Buffs_food_sugar: IBuff[]; + Buffs_drink_vodka: IBuff[]; + Buffs_drink_jack: IBuff[]; + Buffs_drink_moonshine: IBuff[]; + Buffs_drink_purewater: IBuff[]; + Buffs_3bTG: IBuff[]; + Buffs_AHF1M: IBuff[]; + Buffs_L1: IBuff[]; + Buffs_MULE: IBuff[]; + Buffs_Meldonin: IBuff[]; + Buffs_Obdolbos: IBuff[]; + Buffs_P22: IBuff[]; + Buffs_KultistsToxin: IBuff[]; + Buffs_BodyTemperature: IBuff[]; + Buffs_Antidote: IBuff[]; + Buffs_melee_bleed: IBuff[]; + Buffs_melee_blunt: IBuff[]; + Buffs_hultafors: IBuff[]; + Buffs_drink_vodka_BAD: IBuff[]; + Buffs_food_alyonka: IBuff[]; + Buffs_food_slippers: IBuff[]; + Buffs_knife: IBuff[]; } -export interface Buff { +export interface IBuff { BuffType: string; Chance: number; Delay: number; @@ -542,17 +563,17 @@ export interface Buff { AbsoluteValue: boolean; SkillName: string; } -export interface Tremor { +export interface ITremor { DefaultDelay: number; DefaultResidueTime: number; } -export interface ChronicStaminaFatigue { +export interface IChronicStaminaFatigue { EnergyRate: number; WorkingTime: number; TicksEvery: number; EnergyRatePerStack: number; } -export interface Fracture2 { +export interface IFracture { DefaultDelay: number; DefaultResidueTime: number; HealExperience: number; @@ -560,10 +581,10 @@ export interface Fracture2 { OfflineDurationMax: number; RemovePrice: number; RemovedAfterDeath: boolean; - BulletHitProbability: Probability; - FallingProbability: Probability; + BulletHitProbability: IProbability; + FallingProbability: IProbability; } -export interface HeavyBleeding2 { +export interface IHeavyBleeding { DefaultDelay: number; DefaultResidueTime: number; DamageEnergy: number; @@ -579,15 +600,15 @@ export interface HeavyBleeding2 { OfflineDurationMax: number; RemovePrice: number; RemovedAfterDeath: boolean; - Probability: Probability; + Probability: IProbability; } -export interface Probability { +export interface IProbability { FunctionType: string; K: number; B: number; Threshold: number; } -export interface LightBleeding2 { +export interface ILightBleeding { DefaultDelay: number; DefaultResidueTime: number; DamageEnergy: number; @@ -603,78 +624,78 @@ export interface LightBleeding2 { OfflineDurationMax: number; RemovePrice: number; RemovedAfterDeath: boolean; - Probability: Probability; + Probability: IProbability; } -export interface BodyTemperature { +export interface IBodyTemperature { DefaultBuildUpTime: number; DefaultResidueTime: number; LoopTime: number; } -export interface HealPrice { +export interface IHealPrice { HealthPointPrice: number; HydrationPointPrice: number; EnergyPointPrice: number; TrialLevels: number; TrialRaids: number; } -export interface ProfileHealthSettings { - BodyPartsSettings: BodyPartsSettings; - HealthFactorsSettings: HealthFactorsSettings; +export interface IProfileHealthSettings { + BodyPartsSettings: IBodyPartsSettings; + HealthFactorsSettings: IHealthFactorsSettings; DefaultStimulatorBuff: string; } -export interface BodyPartsSettings { - Head: BodyPartsSetting; - Chest: BodyPartsSetting; - Stomach: BodyPartsSetting; - LeftArm: BodyPartsSetting; - RightArm: BodyPartsSetting; - LeftLeg: BodyPartsSetting; - RightLeg: BodyPartsSetting; +export interface IBodyPartsSettings { + Head: IBodyPartsSetting; + Chest: IBodyPartsSetting; + Stomach: IBodyPartsSetting; + LeftArm: IBodyPartsSetting; + RightArm: IBodyPartsSetting; + LeftLeg: IBodyPartsSetting; + RightLeg: IBodyPartsSetting; } -export interface BodyPartsSetting { +export interface IBodyPartsSetting { Minimum: number; Maximum: number; Default: number; OverDamageReceivedMultiplier: number; } -export interface HealthFactorsSettings { - Energy: HealthFactorSetting; - Hydration: HealthFactorSetting; - Temperature: HealthFactorSetting; - Poisoning: HealthFactorSetting; - Radiation: HealthFactorSetting; +export interface IHealthFactorsSettings { + Energy: IHealthFactorSetting; + Hydration: IHealthFactorSetting; + Temperature: IHealthFactorSetting; + Poisoning: IHealthFactorSetting; + Radiation: IHealthFactorSetting; } -export interface HealthFactorSetting { +export interface IHealthFactorSetting { Minimum: number; Maximum: number; Default: number; } -export interface Rating { +export interface IRating { levelRequired: number; limit: number; - categories: Categories; + categories: ICategories; } -export interface Categories { +export interface ICategories { experience: boolean; kd: boolean; surviveRatio: boolean; avgEarnings: boolean; - kills: boolean; + pmcKills: boolean; raidCount: boolean; longestShot: boolean; timeOnline: boolean; inventoryFullCost: boolean; ragFairStanding: boolean; } -export interface Tournament { - categories: Categories2; +export interface ITournament { + categories: ITournamentCategories; limit: number; levelRequired: number; } -export interface Categories2 { +export interface ITournamentCategories { dogtags: boolean; } -export interface RagFair { +export interface IRagFair { enabled: boolean; priceStabilizerEnabled: boolean; includePveTraderSales: boolean; @@ -689,7 +710,7 @@ export interface RagFair { priorityTimeModifier: number; maxRenewOfferTimeInHour: number; renewPricePerHour: number; - maxActiveOfferCount: MaxActiveOfferCount[]; + maxActiveOfferCount: IMaxActiveOfferCount[]; balancerRemovePriceCoefficient: number; balancerMinPriceCount: number; balancerAveragePriceCoefficient: number; @@ -701,7 +722,7 @@ export interface RagFair { ratingDecreaseCount: number; maxSumForIncreaseRatingPerOneSale: number; maxSumForDecreaseRatingPerOneSale: number; - maxSumForRarity: MaxSumForRarity; + maxSumForRarity: IMaxSumForRarity; ChangePriceCoef: number; balancerUserItemSaleCooldownEnabled: boolean; balancerUserItemSaleCooldown: number; @@ -710,24 +731,24 @@ export interface RagFair { isOnlyFoundInRaidAllowed: boolean; sellInOnePiece: number; } -export interface MaxActiveOfferCount { +export interface IMaxActiveOfferCount { from: number; to: number; count: number; } -export interface MaxSumForRarity { - Common: RarityMaxSum; - Rare: RarityMaxSum; - Superrare: RarityMaxSum; - Not_exist: RarityMaxSum; +export interface IMaxSumForRarity { + Common: IRarityMaxSum; + Rare: IRarityMaxSum; + Superrare: IRarityMaxSum; + Not_exist: IRarityMaxSum; } -export interface RarityMaxSum { +export interface IRarityMaxSum { value: number; } -export interface Handbook { +export interface IHandbook { defaultCategory: string; } -export interface Stamina { +export interface IStamina { Capacity: number; SprintDrainRate: number; BaseRestorationRate: number; @@ -738,27 +759,28 @@ export interface Stamina { AimRangeFinderDrainRate: number; OxygenCapacity: number; OxygenRestoration: number; - WalkOverweightLimits: xyz; - BaseOverweightLimits: xyz; - SprintOverweightLimits: xyz; - WalkSpeedOverweightLimits: xyz; - CrouchConsumption: xyz; - WalkConsumption: xyz; - StandupConsumption: xyz; - TransitionSpeed: xyz; + WalkOverweightLimits: Ixyz; + BaseOverweightLimits: Ixyz; + SprintOverweightLimits: Ixyz; + WalkSpeedOverweightLimits: Ixyz; + CrouchConsumption: Ixyz; + WalkConsumption: Ixyz; + StandupConsumption: Ixyz; + TransitionSpeed: Ixyz; SprintAccelerationLowerLimit: number; SprintSpeedLowerLimit: number; SprintSensitivityLowerLimit: number; - AimConsumptionByPose: xyz; - RestorationMultiplierByPose: xyz; - OverweightConsumptionByPose: xyz; + AimConsumptionByPose: Ixyz; + RestorationMultiplierByPose: Ixyz; + OverweightConsumptionByPose: Ixyz; AimingSpeedMultiplier: number; WalkVisualEffectMultiplier: number; + WeaponFastSwitchConsumption: number; HandsCapacity: number; HandsRestoration: number; ProneConsumption: number; BaseHoldBreathConsumption: number; - SoundRadius: xyz; + SoundRadius: Ixyz; ExhaustedMeleeSpeed: number; FatigueRestorationRate: number; FatigueAmountToCreateEffect: number; @@ -769,12 +791,12 @@ export interface Stamina { StaminaExhaustionCausesJiggle: boolean; StaminaExhaustionStartsBreathSound: boolean; StaminaExhaustionRocksCamera: boolean; - HoldBreathStaminaMultiplier: xyz; - PoseLevelIncreaseSpeed: xyz; - PoseLevelDecreaseSpeed: xyz; - PoseLevelConsumptionPerNotch: xyz; + HoldBreathStaminaMultiplier: Ixyz; + PoseLevelIncreaseSpeed: Ixyz; + PoseLevelDecreaseSpeed: Ixyz; + PoseLevelConsumptionPerNotch: Ixyz; } -export interface StaminaRestoration { +export interface IStaminaRestoration { LowerLeftPoint: number; LowerRightPoint: number; LeftPlatoPoint: number; @@ -782,7 +804,7 @@ export interface StaminaRestoration { RightLimit: number; ZeroValue: number; } -export interface StaminaDrain { +export interface IStaminaDrain { LowerLeftPoint: number; LowerRightPoint: number; LeftPlatoPoint: number; @@ -790,17 +812,17 @@ export interface StaminaDrain { RightLimit: number; ZeroValue: number; } -export interface RequirementReferences { - Alpinist: Alpinist[]; +export interface IRequirementReferences { + Alpinist: IAlpinist[]; } -export interface Alpinist { +export interface IAlpinist { Requirement: string; Id: string; Count: number; RequiredSlot: string; RequirementTip: string; } -export interface RestrictionsInRaid { +export interface IRestrictionsInRaid { TemplateId: string; Value: number; } @@ -809,36 +831,36 @@ export interface ISquadSettings { SecondsForExpiredRequest: number; SendRequestDelaySeconds: number; } -export interface Insurance { +export interface IInsurance { MaxStorageTimeInHour: number; } -export interface SkillsSettings { +export interface ISkillsSettings { SkillProgressRate: number; WeaponSkillProgressRate: number; WeaponSkillRecoilBonusPerLevel: number; - HideoutManagement: HideoutManagement; - Crafting: Crafting; - Metabolism: Metabolism; + HideoutManagement: IHideoutManagement; + Crafting: ICrafting; + Metabolism: IMetabolism; Immunity: Immunity; - Endurance: Endurance; - Strength: Strength; - Vitality: Vitality; - Health: Health2; - StressResistance: StressResistance; - Throwing: Throwing; - RecoilControl: RecoilControl; - Pistol: WeaponSkills; - Revolver: WeaponSkills; + Endurance: IEndurance; + Strength: IStrength; + Vitality: IVitality; + Health: IHealthSkillProgress; + StressResistance: IStressResistance; + Throwing: IThrowing; + RecoilControl: IRecoilControl; + Pistol: IWeaponSkills; + Revolver: IWeaponSkills; SMG: any[]; - Assault: WeaponSkills; - Shotgun: WeaponSkills; - Sniper: WeaponSkills; + Assault: IWeaponSkills; + Shotgun: IWeaponSkills; + Sniper: IWeaponSkills; LMG: any[]; HMG: any[]; Launcher: any[]; AttachedLauncher: any[]; Melee: IMeleeSkill; - DMR: WeaponSkills; + DMR: IWeaponSkills; BearAssaultoperations: any[]; BearAuthority: any[]; BearAksystems: any[]; @@ -850,41 +872,41 @@ export interface SkillsSettings { UsecNegotiations: any[]; UsecTactics: any[]; BotReload: any[]; - CovertMovement: CovertMovement; + CovertMovement: ICovertMovement; FieldMedicine: any[]; - Search: Search; + Search: ISearch; Sniping: any[]; ProneMovement: any[]; FirstAid: any[]; - LightVests: ArmorSkills; - HeavyVests: ArmorSkills; + LightVests: IArmorSkills; + HeavyVests: IArmorSkills; WeaponModding: any[]; AdvancedModding: any[]; NightOps: any[]; SilentOps: any[]; Lockpicking: any[]; - WeaponTreatment: WeaponTreatment; - MagDrills: MagDrills; + WeaponTreatment: IWeaponTreatment; + MagDrills: IMagDrills; Freetrading: any[]; Auctions: any[]; Cleanoperations: any[]; Barter: any[]; Shadowconnections: any[]; Taskperformance: any[]; - Perception: Perception; + Perception: IPerception; Intellect: Intellect; - Attention: Attention; - Charisma: Charisma; - Memory: Memory; - Surgery: Surgery; - AimDrills: AimDrills; + Attention: IAttention; + Charisma: ICharisma; + Memory: IMemory; + Surgery: ISurgery; + AimDrills: IAimDrills; BotSound: any[]; - TroubleShooting: TroubleShooting; + TroubleShooting: ITroubleShooting; } export interface IMeleeSkill { BuffSettings: IBuffSettings; } -export interface ArmorSkills { +export interface IArmorSkills { BuffMaxCount: number; BuffSettings: IBuffSettings; Counters: IArmorCounters; @@ -900,35 +922,35 @@ export interface ArmorSkills { export interface IArmorCounters { armorDurability: ISkillCounter; } -export interface HideoutManagement { +export interface IHideoutManagement { SkillPointsPerAreaUpgrade: number; SkillPointsPerCraft: number; ConsumptionReductionPerLevel: number; SkillBoostPercent: number; - SkillPointsRate: SkillPointsRate; - EliteSlots: EliteSlots; + SkillPointsRate: ISkillPointsRate; + EliteSlots: IEliteSlots; } -export interface SkillPointsRate { - Generator: Generator; - AirFilteringUnit: SkillPointRate; - WaterCollector: SkillPointRate; - SolarPower: SkillPointRate; +export interface ISkillPointsRate { + Generator: ISkillPointRate; + AirFilteringUnit: ISkillPointRate; + WaterCollector: ISkillPointRate; + SolarPower: ISkillPointRate; } -export interface SkillPointRate { +export interface ISkillPointRate { ResourceSpent: number; PointsGained: number; } -export interface EliteSlots { - Generator: EliteSlot; - AirFilteringUnit: EliteSlot; - WaterCollector: EliteSlot; - BitcoinFarm: EliteSlot; +export interface IEliteSlots { + Generator: IEliteSlot; + AirFilteringUnit: IEliteSlot; + WaterCollector: IEliteSlot; + BitcoinFarm: IEliteSlot; } -export interface EliteSlot { +export interface IEliteSlot { Slots: number; Container: number; } -export interface Crafting { +export interface ICrafting { PointsPerCraftingCycle: number; CraftingCycleHours: number; PointsPerUniqueCraftCycle: number; @@ -938,7 +960,7 @@ export interface Crafting { EliteExtraProductions: number; CraftingPointsToInteligence: number; } -export interface Metabolism { +export interface IMetabolism { HydrationRecoveryRate: number; EnergyRecoveryRate: number; IncreasePositiveEffectDurationRate: number; @@ -952,14 +974,14 @@ export interface Immunity { HealthNegativeEffect: number; StimulatorNegativeBuff: number; } -export interface Endurance { +export interface IEndurance { MovementAction: number; SprintAction: number; GainPerFatigueStack: number; DependentSkillRatios: IDependentSkillRatio[]; QTELevelMultipliers: Record>; } -export interface Strength { +export interface IStrength { DependentSkillRatios: IDependentSkillRatio[]; SprintActionMin: number; SprintActionMax: number; @@ -979,38 +1001,38 @@ export interface IQTELevelMultiplier { Level: number; Multiplier: number; } -export interface Vitality { +export interface IVitality { DamageTakenAction: number; HealthNegativeEffect: number; } -export interface Health2 { +export interface IHealthSkillProgress { SkillProgress: number; } -export interface StressResistance { +export interface IStressResistance { HealthNegativeEffect: number; LowHPDuration: number; } -export interface Throwing { +export interface IThrowing { ThrowAction: number; } -export interface RecoilControl { +export interface IRecoilControl { RecoilAction: number; RecoilBonusPerLevel: number; } -export interface WeaponSkills { +export interface IWeaponSkills { WeaponReloadAction: number; WeaponShotAction: number; WeaponFixAction: number; WeaponChamberAction: number; } -export interface CovertMovement { +export interface ICovertMovement { MovementAction: number; } -export interface Search { +export interface ISearch { SearchAction: number; FindAction: number; } -export interface WeaponTreatment { +export interface IWeaponTreatment { BuffMaxCount: number; BuffSettings: IBuffSettings; Counters: IWeaponTreatmentCounters; @@ -1031,12 +1053,12 @@ export interface IBuffSettings { RareBuffChanceCoff: number; ReceivedDurabilityMaxPercent: number; } -export interface MagDrills { +export interface IMagDrills { RaidLoadedAmmoAction: number; RaidUnloadedAmmoAction: number; MagazineCheckAction: number; } -export interface Perception { +export interface IPerception { DependentSkillRatios: ISkillRatio[]; OnlineAction: number; UniqueLoot: number; @@ -1063,13 +1085,13 @@ export interface ISkillCounter { divisor: number; points: number; } -export interface Attention { +export interface IAttention { DependentSkillRatios: ISkillRatio[]; ExamineWithInstruction: number; FindActionFalse: number; FindActionTrue: number; } -export interface Charisma { +export interface ICharisma { BonusSettings: IBonusSettings; Counters: ICharismaSkillCounters; SkillProgressInt: number; @@ -1100,26 +1122,26 @@ export interface ILevelBonusSettings { PaidExitDiscount: number; RepeatableQuestChangeDiscount: number; } -export interface Memory { +export interface IMemory { AnySkillUp: number; SkillProgress: number; } -export interface Surgery { +export interface ISurgery { SurgeryAction: number; SkillProgress: number; } -export interface AimDrills { +export interface IAimDrills { WeaponShotAction: number; } -export interface TroubleShooting { +export interface ITroubleShooting { MalfRepairSpeedBonusPerLevel: number; SkillPointsPerMalfFix: number; EliteDurabilityChanceReduceMult: number; EliteAmmoChanceReduceMult: number; EliteMagChanceReduceMult: number; } -export interface Aiming { - ProceduralIntensityByPose: xyz; +export interface IAiming { + ProceduralIntensityByPose: Ixyz; AimProceduralIntensity: number; HeavyWeight: number; LightWeight: number; @@ -1130,16 +1152,16 @@ export interface Aiming { RecoilScaling: number; RecoilDamping: number; CameraSnapGlobalMult: number; - RecoilXIntensityByPose: xyz; - RecoilYIntensityByPose: xyz; - RecoilZIntensityByPose: xyz; + RecoilXIntensityByPose: Ixyz; + RecoilYIntensityByPose: Ixyz; + RecoilZIntensityByPose: Ixyz; RecoilCrank: boolean; RecoilHandDamping: number; RecoilConvergenceMult: number; RecoilVertBonus: number; RecoilBackBonus: number; } -export interface Malfunction { +export interface IMalfunction { AmmoMalfChanceMult: number; MagazineMalfChanceMult: number; MalfRepairHardSlideMult: number; @@ -1150,7 +1172,7 @@ export interface Malfunction { OutToIdleSpeedMultForPistol: number; IdleToOutSpeedMultOnMalf: number; TimeToQuickdrawPistol: number; - DurRangeToIgnoreMalfs: xyz; + DurRangeToIgnoreMalfs: Ixyz; DurFeedWt: number; DurMisfireWt: number; DurJamWt: number; @@ -1166,7 +1188,7 @@ export interface Malfunction { OverheatHardSlideMinWt: number; OverheatHardSlideMaxWt: number; } -export interface Overheat { +export interface IOverheat { MinOverheat: number; MaxOverheat: number; OverheatProblemsStart: number; @@ -1196,12 +1218,12 @@ export interface Overheat { AutoshotPossibilityDuration: number; MaxOverheatCoolCoef: number; } -export interface FenceSettings { +export interface IFenceSettings { FenceId: string; - Levels: Record; + Levels: Record; paidExitStandingNumerator: number; } -export interface FenceLevel { +export interface IFenceLevel { SavageCooldownModifier: number; ScavCaseTimeModifier: number; PaidExitCostModifier: number; @@ -1213,56 +1235,56 @@ export interface FenceLevel { ScavAttackSupport: boolean; ExfiltrationPriceModifier: number; AvailableExits: number; + BotApplySilenceChance: number; + BotGetInCoverChance: number; + BotHelpChance: number; + BotSpreadoutChance: number; + BotStopChance: number; } -export interface Inertia { - InertiaLimits: xyz; +export interface IInertia { + InertiaLimits: Ixyz; InertiaLimitsStep: number; - ExitMovementStateSpeedThreshold: xyz; - WalkInertia: xyz; + ExitMovementStateSpeedThreshold: Ixyz; + WalkInertia: Ixyz; FallThreshold: number; - SpeedLimitAfterFallMin: xyz; - SpeedLimitAfterFallMax: xyz; - SpeedLimitDurationMin: xyz; - SpeedLimitDurationMax: xyz; - SpeedInertiaAfterJump: xyz; + SpeedLimitAfterFallMin: Ixyz; + SpeedLimitAfterFallMax: Ixyz; + SpeedLimitDurationMin: Ixyz; + SpeedLimitDurationMax: Ixyz; + SpeedInertiaAfterJump: Ixyz; BaseJumpPenaltyDuration: number; DurationPower: number; BaseJumpPenalty: number; PenaltyPower: number; - InertiaTiltCurveMin: xyz; - InertiaTiltCurveMax: xyz; - InertiaBackwardCoef: xyz; - TiltInertiaMaxSpeed: xyz; - TiltStartSideBackSpeed: xyz; - TiltMaxSideBackSpeed: xyz; - TiltAcceleration: xyz; + InertiaTiltCurveMin: Ixyz; + InertiaTiltCurveMax: Ixyz; + InertiaBackwardCoef: Ixyz; + TiltInertiaMaxSpeed: Ixyz; + TiltStartSideBackSpeed: Ixyz; + TiltMaxSideBackSpeed: Ixyz; + TiltAcceleration: Ixyz; AverageRotationFrameSpan: number; - SprintSpeedInertiaCurveMin: xyz; - SprintSpeedInertiaCurveMax: xyz; - SprintBrakeInertia: xyz; - SprintTransitionMotionPreservation: xyz; - WeaponFlipSpeed: xyz; - PreSprintAccelerationLimits: xyz; - SprintAccelerationLimits: xyz; - SideTime: xyz; - DiagonalTime: xyz; - MaxTimeWithoutInput: xyz; + SprintSpeedInertiaCurveMin: Ixyz; + SprintSpeedInertiaCurveMax: Ixyz; + SprintBrakeInertia: Ixyz; + SprintTransitionMotionPreservation: Ixyz; + WeaponFlipSpeed: Ixyz; + PreSprintAccelerationLimits: Ixyz; + SprintAccelerationLimits: Ixyz; + SideTime: Ixyz; + DiagonalTime: Ixyz; + MaxTimeWithoutInput: Ixyz; MinDirectionBlendTime: number; - MoveTimeRange: xyz; - ProneDirectionAccelerationRange: xyz; - ProneSpeedAccelerationRange: xyz; - MinMovementAccelerationRangeRight: xyz; - MaxMovementAccelerationRangeRight: xyz; + MoveTimeRange: Ixyz; + ProneDirectionAccelerationRange: Ixyz; + ProneSpeedAccelerationRange: Ixyz; + MinMovementAccelerationRangeRight: Ixyz; + MaxMovementAccelerationRangeRight: Ixyz; } -export interface xyz { - x: number; - y: number; - z: number; -} -export interface Ballistic { +export interface IBallistic { GlobalDamageDegradationCoefficient: number; } -export interface RepairSettings { +export interface IRepairSettings { ItemEnhancementSettings: IItemEnhancementSettings; MinimumLevelToApplyBuff: number; RepairStrategies: IRepairStrategies; @@ -1286,7 +1308,7 @@ export interface IRepairStrategy { BuffTypes: string[]; Filter: string[]; } -export interface BotPreset { +export interface IBotPreset { UseThis: boolean; Role: string; BotDifficulty: string; @@ -1299,13 +1321,27 @@ export interface BotPreset { FIRST_CONTACT_ADD_SEC: number; COEF_IF_MOVE: number; } -export interface BotWeaponScattering { +export interface IAudioSettings { + AudioGroupPresets: IAudioGroupPreset[]; +} +export interface IAudioGroupPreset { + AngleToAllowBinaural: number; + DisabledBinauralByDistance: boolean; + DistanceToAllowBinaural: number; + GroupType: number; + HeightToAllowBinaural: number; + Name: string; + OcclusionEnabled: boolean; + OcclusionIntensity: number; + OverallVolume: number; +} +export interface IBotWeaponScattering { Name: string; PriorityScatter1meter: number; PriorityScatter10meter: number; PriorityScatter100meter: number; } -export interface Preset { +export interface IPreset { _id: string; _type: string; _changeWeaponName: boolean; 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 54c70ba..5f24907 100644 --- a/types/models/eft/common/ILocationBase.d.ts +++ b/types/models/eft/common/ILocationBase.d.ts @@ -1,3 +1,5 @@ +import { MinMax } from "../../../models/common/MinMax"; +import { Ixyz } from "./Ixyz"; export interface ILocationBase { AccessKeys: string[]; AirdropParameters: AirdropParameter[]; @@ -16,6 +18,8 @@ export interface ILocationBase { BotMaxPlayer: number; BotMaxTimePlayer: number; BotNormal: number; + BotSpawnCountStep: number; + BotSpawnPeriodCheck: number; BotSpawnTimeOffMax: number; BotSpawnTimeOffMin: number; BotSpawnTimeOnMax: number; @@ -28,6 +32,7 @@ export interface ILocationBase { Enabled: boolean; EnableCoop: boolean; GlobalLootChanceModifier: number; + GlobalContainerChanceModifier: number; IconX: number; IconY: number; Id: string; @@ -35,6 +40,7 @@ export interface ILocationBase { IsSecret: boolean; Locked: boolean; Loot: any[]; + MatchMakerMinPlayersByWaitTime: MinPlayerWaitTime[]; MaxBotPerZone: number; MaxDistToFreePoint: number; MaxPlayers: number; @@ -44,11 +50,13 @@ export interface ILocationBase { MinPlayers: number; MaxCoopGroup: number; Name: string; + NonWaveGroupScenario: INonWaveGroupScenario; NewSpawn: boolean; OcculsionCullingEnabled: boolean; OldSpawn: boolean; OpenZones: string; Preview: Preview; + PlayersRequestCount: number; RequiredPlayerLevel?: number; RequiredPlayerLevelMin?: number; RequiredPlayerLevelMax?: number; @@ -81,9 +89,13 @@ export interface ILocationBase { users_summon_seconds: number; waves: Wave[]; } -export interface ILimit { - min: number; - max: number; +export interface INonWaveGroupScenario { + Chance: number; + Enabled: boolean; + MaxToBeGroup: number; + MinToBeGroup: number; +} +export interface ILimit extends MinMax { items: any[]; } export interface AirdropParameter { @@ -140,10 +152,12 @@ export interface BotLocationModifier { Scattering: number; VisibleDistance: number; } -export interface MinMaxBot { - WildSpawnType: WildSpawnType; - max: number; - min: number; +export interface MinMaxBot extends MinMax { + WildSpawnType: WildSpawnType | string; +} +export interface MinPlayerWaitTime { + minPlayers: number; + time: number; } export interface Preview { path: string; @@ -160,7 +174,7 @@ export interface SpawnPointParam { DelayToCanSpawnSec: number; Id: string; Infiltration: string; - Position: xyz; + Position: Ixyz; Rotation: number; Sides: string[]; } @@ -169,14 +183,9 @@ export interface ColliderParams { _props: Props; } export interface Props { - Center: xyz; + Center: Ixyz; Radius: number; } -export interface xyz { - x: number; - y: number; - z: number; -} export interface Exit { Chance: number; Count: number; @@ -208,8 +217,10 @@ export interface Wave { time_max: number; time_min: number; sptId?: string; + ChanceGroup?: number; } export declare enum WildSpawnType { ASSAULT = "assault", - MARKSMAN = "marksman" + MARKSMAN = "marksman", + PMCBOT = "pmcbot" } diff --git a/types/models/eft/common/ILooseLoot.d.ts b/types/models/eft/common/ILooseLoot.d.ts index 572ec69..09696d4 100644 --- a/types/models/eft/common/ILooseLoot.d.ts +++ b/types/models/eft/common/ILooseLoot.d.ts @@ -1,3 +1,4 @@ +import { Ixyz } from "./Ixyz"; import { Item } from "./tables/IItem"; export interface ILooseLoot { spawnpointCount: SpawnpointCount; @@ -15,14 +16,15 @@ export interface SpawnpointsForced { } export interface SpawnpointTemplate { Id: string; - IsStatic: boolean; + IsContainer: boolean; useGravity: boolean; randomRotation: boolean; - Position: Xyz; - Rotation: Xyz; + Position: Ixyz; + Rotation: Ixyz; + IsAlwaysSpawn: boolean; IsGroupPosition: boolean; GroupPositions: any[]; - Root: any; + Root: string; Items: Item[]; } export interface Spawnpoint { @@ -31,11 +33,6 @@ export interface Spawnpoint { template: SpawnpointTemplate; itemDistribution: ItemDistribution[]; } -export interface Xyz { - x: number; - y: number; - z: number; -} export interface ItemDistribution { composedKey: ComposedKey; relativeProbability: number; 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/Ixyz.d.ts b/types/models/eft/common/Ixyz.d.ts new file mode 100644 index 0000000..612dae1 --- /dev/null +++ b/types/models/eft/common/Ixyz.d.ts @@ -0,0 +1,5 @@ +export interface Ixyz { + x: number; + y: number; + z: number; +} diff --git a/types/models/eft/common/tables/IBotBase.d.ts b/types/models/eft/common/tables/IBotBase.d.ts index cd4169d..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; @@ -40,6 +42,7 @@ export interface Info { Nickname: string; LowerNickname: string; Side: string; + SquadInviteRestriction: boolean; Voice: string; Level: number; Experience: number; @@ -120,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 { @@ -145,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; @@ -266,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; } @@ -290,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 { @@ -340,7 +355,7 @@ export declare enum SurvivorClass { PARAMEDIC = 3, SURVIVOR = 4 } -export interface Quest { +export interface IQuestStatus { qid: string; startTime: number; status: QuestStatus; @@ -352,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/ICustomizationItem.d.ts b/types/models/eft/common/tables/ICustomizationItem.d.ts index 8bfeece..98f2398 100644 --- a/types/models/eft/common/tables/ICustomizationItem.d.ts +++ b/types/models/eft/common/tables/ICustomizationItem.d.ts @@ -1,3 +1,4 @@ +import { Ixyz } from "../Ixyz"; export interface ICustomizationItem { _id: string; _name: string; @@ -19,15 +20,10 @@ export interface Props { Prefab: Prefab; WatchPrefab: Prefab; IntegratedArmorVest: boolean; - WatchPosition: Xyz; - WatchRotation: Xyz; + WatchPosition: Ixyz; + WatchRotation: Ixyz; } export interface Prefab { path: string; rcid: string; } -export interface Xyz { - x: number; - y: number; - z: number; -} 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 e4baac5..681c32f 100644 --- a/types/models/eft/common/tables/ILootBase.d.ts +++ b/types/models/eft/common/tables/ILootBase.d.ts @@ -1,3 +1,4 @@ +import { Ixyz } from "../Ixyz"; import { Item } from "./IItem"; export interface ILootBase { staticAmmo: Record; @@ -10,40 +11,34 @@ 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: Xyz; - Rotation: Xyz; + 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: Xyz; - Rotation: Xyz; - IsGroupPosition: boolean; - GroupPositions: any[]; - Root: any; +export interface IStaticContainerProps extends IStaticPropsBase { Items: StaticItem[]; } -export interface Xyz { - x: number; - y: number; - z: number; -} export interface StaticItem { - _id: any; + _id: string; _tpl: string; } export interface IStaticForcedProps { 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 52968b1..300a027 100644 --- a/types/models/eft/common/tables/IQuest.d.ts +++ b/types/models/eft/common/tables/IQuest.d.ts @@ -1,7 +1,9 @@ import { QuestRewardType } from "../../../enums/QuestRewardType"; import { QuestStatus } from "../../../enums/QuestStatus"; +import { QuestTypeEnum } from "../../../enums/QuestTypeEnum"; import { Item } from "./IItem"; export interface IQuest { + /** SPT addition - human readable quest name */ QuestName?: string; _id: string; canShowNotificationsInGame: boolean; @@ -13,9 +15,10 @@ export interface IQuest { traderId: string; location: string; image: string; - type: string; + type: QuestTypeEnum; isKey: boolean; - questStatus: any; + /** @deprecated - Likely not used, use 'status' instead */ + questStatus: QuestStatus; restartable: boolean; instantComplete: boolean; secretQuest: boolean; @@ -23,10 +26,14 @@ export interface IQuest { successMessageText: string; templateId: string; rewards: Rewards; + /** Becomes 'AppearStatus' inside client */ status: string | number; KeyQuest: boolean; changeQuestMessageText: string; + /** "Pmc" or "Scav" */ side: string; + /** Status of quest to player */ + sptStatus?: QuestStatus; } export interface Conditions { Started: AvailableForConditions[]; @@ -64,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 39c8e90..147847b 100644 --- a/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/types/models/eft/common/tables/ITemplateItem.d.ts @@ -1,3 +1,4 @@ +import { Ixyz } from "../Ixyz"; export interface ITemplateItem { _id: string; _name: string; @@ -8,6 +9,7 @@ export interface ITemplateItem { } export interface Props { AllowSpawnOnLocations?: any[]; + BeltMagazineRefreshCount?: number; ChangePriceCoef?: number; FixedPrice?: boolean; SendToClient?: boolean; @@ -36,6 +38,7 @@ export interface Props { IsUnremovable?: boolean; IsLockedafterEquip?: boolean; IsSpecialSlotOnly?: boolean; + IsStationaryWeapon?: boolean; QuestItem?: boolean; QuestStashMaxCount?: number; LootExperience?: number; @@ -81,6 +84,7 @@ export interface Props { Velocity?: number; RaidModdable?: boolean; ToolModdable?: boolean; + UniqueAnimationModID?: number; BlocksFolding?: boolean; BlocksCollapsible?: boolean; IsAnimated?: boolean; @@ -104,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; @@ -200,16 +206,17 @@ export interface Props { CameraSnap?: number; ReloadMode?: string; AimPlane?: number; - TacticalReloadStiffnes?: Xyz; + TacticalReloadStiffnes?: Ixyz; TacticalReloadFixation?: number; - RecoilCenter?: Xyz; - RotationCenter?: Xyz; - RotationCenterNoStock?: Xyz; + RecoilCenter?: Ixyz; + RotationCenter?: Ixyz; + RotationCenterNoStock?: Ixyz; FoldedSlot?: string; CompactHandling?: boolean; MinRepairDegradation?: number; MaxRepairDegradation?: number; IronSightRange?: number; + IsBeltMachineGun?: boolean; IsFlareGun?: boolean; IsGrenadeLauncher?: boolean; IsOneoff?: boolean; @@ -246,7 +253,7 @@ export interface Props { FaceShieldComponent?: boolean; FaceShieldMask?: string; MaterialType?: string; - RicochetParams?: Xyz; + RicochetParams?: Ixyz; DeafStrength?: string; BlindnessProtection?: number; Distortion?: number; @@ -257,6 +264,7 @@ export interface Props { CutoffFreq?: number; Resonance?: number; RolloffMultiplier?: number; + ReverbVolume?: number; CompressorVolume?: number; AmbientVolume?: number; DryVolume?: number; @@ -281,12 +289,12 @@ export interface Props { PrimaryConsumption?: number; SecondryConsumption?: number; DeflectionConsumption?: number; - AppliedTrunkRotation?: Xyz; - AppliedHeadRotation?: Xyz; + AppliedTrunkRotation?: Ixyz; + AppliedHeadRotation?: Ixyz; DisplayOnModel?: boolean; AdditionalAnimationLayer?: number; StaminaBurnRate?: number; - ColliderScaleMultiplier?: Xyz; + ColliderScaleMultiplier?: Ixyz; ConfigPathStr?: string; MaxMarkersCount?: number; scaleMin?: number; @@ -351,9 +359,9 @@ export interface Props { ShowHitEffectOnExplode?: boolean; ExplosionType?: string; AmmoLifeTimeSec?: number; - Contusion?: Xyz; - ArmorDistanceDistanceDamage?: Xyz; - Blindness?: Xyz; + Contusion?: Ixyz; + ArmorDistanceDistanceDamage?: Ixyz; + Blindness?: Ixyz; IsLightAndSoundShot?: boolean; LightAndSoundShotAngle?: number; LightAndSoundShotSelfContusionTime?: number; @@ -413,8 +421,8 @@ export interface Slot { _parent: string; _props: SlotProps; _max_count?: number; - _required: boolean; - _mergeSlotWithChildren: boolean; + _required?: boolean; + _mergeSlotWithChildren?: boolean; _proto: string; } export interface SlotProps { @@ -425,11 +433,6 @@ export interface SlotFilter { Filter: string[]; AnimationIndex?: number; } -export interface Xyz { - x: number; - y: number; - z: number; -} export interface StackSlot { _name?: string; _id: string; diff --git a/types/models/eft/dialog/IAcceptFriendRequestData.d.ts b/types/models/eft/dialog/IAcceptFriendRequestData.d.ts index 190ee69..87461aa 100644 --- a/types/models/eft/dialog/IAcceptFriendRequestData.d.ts +++ b/types/models/eft/dialog/IAcceptFriendRequestData.d.ts @@ -1,3 +1,7 @@ -export interface IAcceptFriendRequestData { +export interface IAcceptFriendRequestData extends IBaseFriendRequest { +} +export interface ICancelFriendRequestData extends IBaseFriendRequest { +} +export interface IBaseFriendRequest { request_id: string; } diff --git a/types/models/eft/dialog/IGetFriendListDataResponse.d.ts b/types/models/eft/dialog/IGetFriendListDataResponse.d.ts index f8d700c..c558a41 100644 --- a/types/models/eft/dialog/IGetFriendListDataResponse.d.ts +++ b/types/models/eft/dialog/IGetFriendListDataResponse.d.ts @@ -1,16 +1,6 @@ -import { MemberCategory } from "../../enums/MemberCategory"; +import { IUserDialogInfo } from "../profile/IAkiProfile"; export interface IGetFriendListDataResponse { - Friends: Friend[]; + Friends: IUserDialogInfo[]; Ignore: string[]; InIgnoreList: string[]; } -export interface Friend { - _id: string; - Info: Info; -} -export interface Info { - Nickname: string; - Side: string; - Level: number; - MemberCategory: MemberCategory; -} diff --git a/types/models/eft/dialog/IGetMailDialogViewResponseData.d.ts b/types/models/eft/dialog/IGetMailDialogViewResponseData.d.ts index 97f18b1..b469dee 100644 --- a/types/models/eft/dialog/IGetMailDialogViewResponseData.d.ts +++ b/types/models/eft/dialog/IGetMailDialogViewResponseData.d.ts @@ -1,6 +1,6 @@ -import { Message } from "../profile/IAkiProfile"; +import { IUserDialogInfo, Message } from "../profile/IAkiProfile"; export interface IGetMailDialogViewResponseData { messages: Message[]; - profiles: any[]; + profiles: IUserDialogInfo[]; hasMessagesWithRewards: boolean; } 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 6930261..3fdc994 100644 --- a/types/models/eft/inRaid/ISaveProgressRequestData.d.ts +++ b/types/models/eft/inRaid/ISaveProgressRequestData.d.ts @@ -1,8 +1,11 @@ -import { IPmcData } from "../common/IPmcData"; +import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState"; +import { IPostRaidPmcData } from "../common/IPmcData"; import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData"; +import { IInsuredItemsData } from "./IInsuredItemsData"; export interface ISaveProgressRequestData { - exit: string; - profile: IPmcData; + exit: PlayerRaidEndState; + profile: IPostRaidPmcData; isPlayerScav: boolean; health: ISyncHealthRequestData; + insurance: IInsuredItemsData[]; } diff --git a/types/models/eft/inventory/IAddItemRequestData.d.ts b/types/models/eft/inventory/IAddItemRequestData.d.ts index 61516d6..24f3e31 100644 --- a/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -1,4 +1,5 @@ export interface IAddItemRequestData { + /** Trader id */ tid: string; items: AddItem[]; } diff --git a/types/models/eft/inventory/IAddItemTempObject.d.ts b/types/models/eft/inventory/IAddItemTempObject.d.ts index 62d4b64..12535ed 100644 --- a/types/models/eft/inventory/IAddItemTempObject.d.ts +++ b/types/models/eft/inventory/IAddItemTempObject.d.ts @@ -4,4 +4,5 @@ export interface IAddItemTempObject { count: number; isPreset: boolean; location?: Location; + containerId?: string; } 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/location/IAirdropLootResult.d.ts b/types/models/eft/location/IAirdropLootResult.d.ts new file mode 100644 index 0000000..6db4b16 --- /dev/null +++ b/types/models/eft/location/IAirdropLootResult.d.ts @@ -0,0 +1,5 @@ +import { LootItem } from "../../../models/spt/services/LootItem"; +export interface IAirdropLootResult { + dropType: string; + loot: LootItem[]; +} diff --git a/types/models/eft/notifier/INotifier.d.ts b/types/models/eft/notifier/INotifier.d.ts index bdb021a..c6c6979 100644 --- a/types/models/eft/notifier/INotifier.d.ts +++ b/types/models/eft/notifier/INotifier.d.ts @@ -7,8 +7,18 @@ export interface INotifierChannel { ws: string; } export interface INotification { - type: "RagfairOfferSold" | "new_message" | "ping"; + type: NotificationType; eventId: string; dialogId?: string; message?: Message; } +export declare enum NotificationType { + RAGFAIR_OFFER_SOLD = "RagfairOfferSold", + RAGFAIR_RATING_CHANGE = "RagfairRatingChange", + /** ChatMessageReceived */ + NEW_MESSAGE = "new_message", + 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 f24a788..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"; @@ -5,8 +6,9 @@ import { Item } from "../common/tables/IItem"; export interface IAkiProfile { info: Info; characters: Characters; + /** Clothing purchases */ suits: string[]; - weaponbuilds: WeaponBuild[]; + userbuilds: IUserBuilds; dialogues: Record; aki: Aki; vitality: Vitality; @@ -21,6 +23,7 @@ export declare class TraderPurchaseData { } export interface Info { id: string; + aid: number; username: string; password: string; wipe: boolean; @@ -30,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; @@ -61,7 +78,7 @@ export interface DialogueInfo { _id: string; type: MessageType; pinned: boolean; - Users?: any[]; + Users?: IUserDialogInfo[]; message: MessagePreview; } export interface Message { @@ -73,9 +90,9 @@ export interface Message { Member?: IUpdatableChatMember; templateId?: string; text?: string; - hasRewards: boolean; + hasRewards?: boolean; rewardCollected: boolean; - items: MessageItems; + items?: MessageItems; maxStorageTime?: number; systemData?: ISystemData; profileChangeEvents?: any[]; @@ -115,6 +132,7 @@ export interface DateTime { export interface Aki { version: string; mods?: ModDetails[]; + receivedGifts: ReceivedGift[]; } export interface ModDetails { name: string; @@ -122,6 +140,10 @@ export interface ModDetails { author: string; dateAdded: number; } +export interface ReceivedGift { + giftId: string; + timestampAccepted: number; +} export interface Vitality { health: Health; effects: Effects; diff --git a/types/models/eft/ragfair/IGetItemPriceResult.d.ts b/types/models/eft/ragfair/IGetItemPriceResult.d.ts index 676322a..a38d434 100644 --- a/types/models/eft/ragfair/IGetItemPriceResult.d.ts +++ b/types/models/eft/ragfair/IGetItemPriceResult.d.ts @@ -1,5 +1,4 @@ -export interface IGetItemPriceResult { +import { MinMax } from "../../../models/common/MinMax"; +export interface IGetItemPriceResult extends MinMax { avg: number; - min: number; - max: 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 0551c56..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", @@ -34,6 +35,7 @@ export declare enum BaseClasses { MAP = "567849dd4bdc2d150f8b456e", MONEY = "543be5dd4bdc2deb348b4569", NIGHTVISION = "5a2c3a9486f774688b05e574", + THERMAL_VISION = "5d21f59b6dbe99052b54ef83", KEY = "543be5e94bdc2df1348b4568", KEY_MECHANICAL = "5c99f98d86f7745c314214b3", KEYCARD = "5c164d2286f774194c5e69fa", @@ -91,5 +93,10 @@ export declare enum BaseClasses { SILENCER = "550aa4cd4bdc2dd8348b456c", PORTABLE_RANGE_FINDER = "61605ddea09d851a0a0c1bbc", ITEM = "54009119af1c881c07000029", - CYLINDER_MAGAZINE = "610720f290b75a49ff2e5e25" + CYLINDER_MAGAZINE = "610720f290b75a49ff2e5e25", + AUXILARY_MOD = "5a74651486f7744e73386dd1", + BIPOD = "55818afb4bdc2dde698b456d", + HEADPHONES = "5645bcb74bdc2ded0b8b4578", + RANDOM_LOOT_CONTAINER = "62f109593b54472778797866", + STACKABLE_ITEM = "5661632d4bdc2d903d8b456b" } diff --git a/types/models/enums/ConfigTypes.d.ts b/types/models/enums/ConfigTypes.d.ts index 2fe01c6..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", @@ -21,5 +23,6 @@ export declare enum ConfigTypes { TRADER = "aki-trader", WEATHER = "aki-weather", SEASONAL_EVENT = "aki-seasonalevents", - LOST_ON_DEATH = "aki-lostondeath" + LOST_ON_DEATH = "aki-lostondeath", + GIFTS = "aki-gifts" } 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/GiftSenderType.d.ts b/types/models/enums/GiftSenderType.d.ts new file mode 100644 index 0000000..fc695c8 --- /dev/null +++ b/types/models/enums/GiftSenderType.d.ts @@ -0,0 +1,5 @@ +export declare enum GiftSenderType { + SYSTEM = "System", + TRADER = "Trader", + USER = "User" +} diff --git a/types/models/enums/GiftSentResult.d.ts b/types/models/enums/GiftSentResult.d.ts new file mode 100644 index 0000000..08930c1 --- /dev/null +++ b/types/models/enums/GiftSentResult.d.ts @@ -0,0 +1,6 @@ +export declare enum GiftSentResult { + FAILED_UNKNOWN = 1, + FAILED_GIFT_ALREADY_RECEIVED = 2, + FAILED_GIFT_DOESNT_EXIST = 3, + SUCCESS = 4 +} 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/PlayerRaidEndState.d.ts b/types/models/enums/PlayerRaidEndState.d.ts new file mode 100644 index 0000000..d792259 --- /dev/null +++ b/types/models/enums/PlayerRaidEndState.d.ts @@ -0,0 +1,7 @@ +export declare enum PlayerRaidEndState { + SURVIVED = "survived", + LEFT = "left", + RUNNER = "runner", + MISSING_IN_ACTION = "missinginaction", + KILLED = "killed" +} diff --git a/types/models/enums/QuestRewardType.d.ts b/types/models/enums/QuestRewardType.d.ts index ff8c5f4..fee0ad2 100644 --- a/types/models/enums/QuestRewardType.d.ts +++ b/types/models/enums/QuestRewardType.d.ts @@ -5,5 +5,8 @@ export declare enum QuestRewardType { TRADER_UNLOCK = "TraderUnlock", ITEM = "Item", ASSORTMENT_UNLOCK = "AssortmentUnlock", - PRODUCTIONS_SCHEME = "ProductionScheme" + PRODUCTIONS_SCHEME = "ProductionScheme", + TRADER_STANDING_RESET = "TraderStandingReset", + TRADER_STANDING_RESTORE = "TraderStandingRestore", + STASH_ROWS = "StashRows" } diff --git a/types/models/enums/QuestTypeEnum.d.ts b/types/models/enums/QuestTypeEnum.d.ts new file mode 100644 index 0000000..6925ac2 --- /dev/null +++ b/types/models/enums/QuestTypeEnum.d.ts @@ -0,0 +1,15 @@ +export declare enum QuestTypeEnum { + PICKUP = "PickUp", + ELIMINATION = "Elimination", + DISCOVER = "Discover", + COMPLETION = "Completion", + EXPLORATION = "Exploration", + LEVELLING = "Levelling", + EXPERIENCE = "Experience", + STANDING = "Standing", + LOYALTY = "Loyalty", + MERCHANT = "Merchant", + SKILL = "Skill", + MULTI = "Multi", + WEAPON_ASSEMBLY = "WeaponAssembly" +} diff --git a/types/models/enums/SeasonalEventType.d.ts b/types/models/enums/SeasonalEventType.d.ts new file mode 100644 index 0000000..d7cf037 --- /dev/null +++ b/types/models/enums/SeasonalEventType.d.ts @@ -0,0 +1,7 @@ +export declare enum SeasonalEventType { + NONE = "None", + CHRISTMAS = "Christmas", + HALLOWEEN = "Halloween", + NEW_YEARS = "NewYears", + PROMO = "Promo" +} 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 03c6a0e..e8a2b5e 100644 --- a/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/types/models/enums/WildSpawnTypeNumber.d.ts @@ -30,5 +30,12 @@ export declare enum WildSpawnTypeNumber { FOLLOWERBIRDEYE = 28, BOSSZRYACHIY = 29, FOLLOWERZRYACHIY = 30, - ARENAFIGHTEREVENT = 31 + BOSSBOAR = 32, + FOLLOWERBOAR = 33, + ARENAFIGHTER = 34, + ARENAFIGHTEREVENT = 35, + BOSSBOARSNIPER = 36, + CRAZYASSAULTEVENT = 37, + SPTUSEC = 38, + SPTBEAR = 39 } diff --git a/types/models/spt/callbacks/IDataCallbacks.d.ts b/types/models/spt/callbacks/IDataCallbacks.d.ts index b4f4f8c..c65eff6 100644 --- a/types/models/spt/callbacks/IDataCallbacks.d.ts +++ b/types/models/spt/callbacks/IDataCallbacks.d.ts @@ -1,6 +1,5 @@ import { IEmptyRequestData } from "../../eft/common/IEmptyRequestData"; import { IGlobals } from "../../eft/common/IGlobals"; -import { IQuest } from "../../eft/common/tables/IQuest"; import { IHideoutArea } from "../../eft/hideout/IHideoutArea"; import { IHideoutProduction } from "../../eft/hideout/IHideoutProduction"; import { IHideoutScavCase } from "../../eft/hideout/IHideoutScavCase"; @@ -14,7 +13,6 @@ export interface IDataCallbacks { getTemplateHandbook(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getTemplateSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getTemplateCharacter(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getTemplateQuests(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; 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/IAirdropConfig.d.ts b/types/models/spt/config/IAirdropConfig.d.ts index cc3dd4e..21bb32e 100644 --- a/types/models/spt/config/IAirdropConfig.d.ts +++ b/types/models/spt/config/IAirdropConfig.d.ts @@ -5,15 +5,26 @@ export interface IAirdropConfig extends IBaseConfig { kind: "aki-airdrop"; airdropChancePercent: AirdropChancePercent; airdropTypeWeightings: Record; + /** Lowest point plane will fly at */ planeMinFlyHeight: number; + /** Highest point plane will fly at */ planeMaxFlyHeight: number; + /** Loudness of plane engine */ planeVolume: number; + /** Speed plane flies overhead */ planeSpeed: number; + /** Speed loot crate falls after being dropped */ crateFallSpeed: number; + /** Container tpls to use when spawning crate - affects container size, keyed by drop type e.g. mixed/weaponArmor/foodMedical/barter */ + containerIds: Record; + /** Earliest time aircraft will spawn in raid */ airdropMinStartTimeSeconds: number; + /** Latest time aircraft will spawn in raid */ airdropMaxStartTimeSeconds: number; + /** What rewards will the loot crate contain, keyed by drop type e.g. mixed/weaponArmor/foodMedical/barter */ loot: Record; } +/** Chance map will have an airdrop occur out of 100 - locations not included count as 0% */ export interface AirdropChancePercent { bigmap: number; woods: number; @@ -23,13 +34,22 @@ export interface AirdropChancePercent { reserve: number; tarkovStreets: number; } +/** Loot inside crate */ export interface AirdropLoot { + /** Min/max of weapons inside crate */ presetCount?: MinMax; + /** Min/max of items inside crate */ itemCount: MinMax; + /** Min/max of sealed weapon boxes inside crate */ + weaponCrateCount: MinMax; + /** Items to never allow - tpls */ itemBlacklist: string[]; + /** Item type (parentId) to allow inside crate */ itemTypeWhitelist: string[]; - /** key: item base type: value: max count */ + /** Item type/ item tpls to limit count of inside crate - key: item base type: value: max count */ itemLimits: Record; + /** Items to limit stack size of key: item tpl value: min/max stack size */ itemStackLimits: Record; + /** Armor levels to allow inside crate e.g. [4,5,6] */ armorLevelWhitelist?: number[]; } diff --git a/types/models/spt/config/IBotConfig.d.ts b/types/models/spt/config/IBotConfig.d.ts index 2e8716e..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,14 +23,16 @@ 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 { assault: number; bossBully: number; @@ -54,6 +55,7 @@ export interface PresetBatch { followerBirdEye: number; followerBigPipe: number; followerTest: number; + followerBoar: number; marksman: number; pmcBot: number; sectantPriest: number; @@ -61,25 +63,45 @@ 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; pmc: number; } export interface EquipmentFilters { + /** Limits for mod types per weapon .e.g. scopes */ weaponModLimits: ModLimits; + /** 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[]; + /** Blacklist equipment by level of bot */ blacklist: EquipmentFilterDetails[]; + /** Whitelist equipment by level of bot */ whitelist: EquipmentFilterDetails[]; - clothing: WeightingAdjustmentDetails[]; - 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 */ @@ -88,27 +110,47 @@ export interface ModLimits { lightLaserLimit?: number; } 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' */ randomisedArmorSlots?: string[]; /** Equipment chances */ equipment?: Record; - /** Modc chances */ + /** Mod chances */ mods?: Record; } export interface EquipmentFilterDetails { + /** Between what levels do these equipment filter setting apply to */ levelRange: MinMax; + /** Key: mod slot name e.g. mod_magazine, value: item tpls */ equipment: Record; + /** Key: cartridge type e.g. Caliber23x75, value: item tpls */ cartridge: Record; } export interface WeightingAdjustmentDetails { + /** Between what levels do these weight settings apply to */ levelRange: MinMax; + /** Key: ammo type e.g. Caliber556x45NATO, value: item tpl + weight */ ammo?: AdjustmentDetails; + /** Key: equipment slot e.g. TacticalVest, value: item tpl + weight */ equipment?: AdjustmentDetails; + /** 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 c37f81f..1207359 100644 --- a/types/models/spt/config/ICoreConfig.d.ts +++ b/types/models/spt/config/ICoreConfig.d.ts @@ -6,5 +6,20 @@ export interface ICoreConfig extends IBaseConfig { compatibleTarkovVersion: string; serverName: string; profileSaveIntervalSeconds: number; - commit: string; + sptFriendNickname: string; + fixes: IGameFixes; + 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 */ + fixShotgunDispersion: boolean; + /** 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/IGiftsConfig.d.ts b/types/models/spt/config/IGiftsConfig.d.ts new file mode 100644 index 0000000..37a132d --- /dev/null +++ b/types/models/spt/config/IGiftsConfig.d.ts @@ -0,0 +1,28 @@ +import { Item } from "../../../models/eft/common/tables/IItem"; +import { IUserDialogInfo } from "../../../models/eft/profile/IAkiProfile"; +import { GiftSenderType } from "../../../models/enums/GiftSenderType"; +import { SeasonalEventType } from "../../../models/enums/SeasonalEventType"; +import { Traders } from "../../../models/enums/Traders"; +import { IBaseConfig } from "./IBaseConfig"; +export interface IGiftsConfig extends IBaseConfig { + kind: "aki-gifts"; + gifts: Record; +} +export interface Gift { + /** Items to send to player */ + items: Item[]; + /** Who is sending the gift to player */ + sender: GiftSenderType; + /** Optinal - supply a users id to send from, not necessary when sending from SYSTEM or TRADER */ + senderId?: string; + senderDetails: IUserDialogInfo; + /** Optional - supply a trader type to send from, not necessary when sending from SYSTEM or USER */ + trader?: Traders; + messageText: string; + /** Optional - if sending text from the client locale file */ + localeTextId?: string; + /** Optional - Used by Seasonal events to send on specific day */ + timestampToSend?: number; + associatedEvent: SeasonalEventType; + collectionTimeHours: number; +} diff --git a/types/models/spt/config/IHideoutConfig.d.ts b/types/models/spt/config/IHideoutConfig.d.ts index 0785f1e..bedd941 100644 --- a/types/models/spt/config/IHideoutConfig.d.ts +++ b/types/models/spt/config/IHideoutConfig.d.ts @@ -3,5 +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 3ae2972..3d3b1a2 100644 --- a/types/models/spt/config/IInRaidConfig.d.ts +++ b/types/models/spt/config/IInRaidConfig.d.ts @@ -2,11 +2,18 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IInRaidConfig extends IBaseConfig { kind: "aki-inraid"; MIAOnRaidEnd: boolean; + /** Overrides to apply to the pre-raid settings screen */ raidMenuSettings: RaidMenuSettings; + /** What effects should be saved post-raid */ save: Save; + /** Names of car extracts */ carExtracts: string[]; + /** Fene rep gain from a single car extract */ 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; @@ -17,6 +24,7 @@ export interface RaidMenuSettings { enablePve: boolean; } export interface Save { + /** Should loot gained from raid be saved */ loot: boolean; durability: boolean; } diff --git a/types/models/spt/config/IInsuranceConfig.d.ts b/types/models/spt/config/IInsuranceConfig.d.ts index fd498bc..b51dc8b 100644 --- a/types/models/spt/config/IInsuranceConfig.d.ts +++ b/types/models/spt/config/IInsuranceConfig.d.ts @@ -1,10 +1,14 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IInsuranceConfig extends IBaseConfig { kind: "aki-insurance"; + /** Insurance price multiplier */ insuranceMultiplier: Record; + /** Chance item is returned as insurance, keyed by trader id */ returnChancePercent: Record; + /** Item slots that should never be returned as insurance */ blacklistedEquipment: string[]; - slotIdsWithChanceOfNotReturning: string[]; + /** Override to control how quickly insurance is processed/returned in second */ returnTimeOverrideSeconds: number; + /** How often server should process insurance in seconds */ runIntervalSeconds: number; } diff --git a/types/models/spt/config/IInventoryConfig.d.ts b/types/models/spt/config/IInventoryConfig.d.ts index 3ad0cce..6657a1a 100644 --- a/types/models/spt/config/IInventoryConfig.d.ts +++ b/types/models/spt/config/IInventoryConfig.d.ts @@ -1,13 +1,26 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; + /** Should new items purchased by flagged as found in raid */ newItemsMarkedFound: boolean; randomLootContainers: Record; + sealedAirdropContainer: ISealedAirdropContainerSettings; /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; foundInRaid: boolean; - rewardTplPool: Record; + rewardTplPool?: Record; + rewardTypePool?: Record; +} +export interface ISealedAirdropContainerSettings { + weaponRewardWeight: Record; + defaultPresetsOnly: boolean; + /** Should contents be flagged as found in raid when opened */ + foundInRaid: boolean; + weaponModRewardLimits: Record; + rewardTypeLimits: Record; + ammoBoxWhitelist: string[]; } diff --git a/types/models/spt/config/ILocationConfig.d.ts b/types/models/spt/config/ILocationConfig.d.ts index bcd91cc..d1af8b3 100644 --- a/types/models/spt/config/ILocationConfig.d.ts +++ b/types/models/spt/config/ILocationConfig.d.ts @@ -1,12 +1,17 @@ +import { MinMax } from "../../../models/common/MinMax"; import { BossLocationSpawn, Wave } from "../../../models/eft/common/ILocationBase"; import { IBaseConfig } from "./IBaseConfig"; export interface ILocationConfig extends IBaseConfig { kind: "aki-location"; + /** Waves with a min/max of the same value don't spawn any bots, bsg only spawn the difference between min and max */ fixEmptyBotWavesSettings: IFixEmptyBotWavesSettings; + /** Rogues are classified as bosses and spawn immediatly, this can result in no scavs spawning, delay rogues spawning to allow scavs to spawn first */ rogueLighthouseSpawnTimeSettings: IRogueLighthouseSpawnTimeSettings; + /** When a map has hit max alive bots, any wave that should spawn will be reduced to 1 bot in size and placed in a spawn queue, this splits waves into smaller sizes to reduce the impact of this behaviour */ splitWaveIntoSingleSpawnsSettings: ISplitWaveSettings; looseLootMultiplier: LootMultiplier; staticLootMultiplier: LootMultiplier; + /** Custom bot waves to add to a locations base json on game start if addCustomBotWavesToMaps is true */ customWaves: CustomWaves; /** Open zones to add to map */ openZones: Record; @@ -14,6 +19,32 @@ export interface ILocationConfig extends IBaseConfig { forcedLootSingleSpawnById: Record; /** How many attempts should be taken to fit an item into a container before giving up */ fitLootIntoContainerAttempts: number; + /** Add all possible zones to each maps `OpenZones` property */ + addOpenZonesToAllMaps: boolean; + /** Allow addition of custom bot waves designed by SPT to be added to maps - defined in configs/location.json.customWaves*/ + addCustomBotWavesToMaps: boolean; + /** Should the limits defined inside botTypeLimits to appled to locations on game start */ + 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; @@ -29,9 +60,14 @@ export interface ISplitWaveSettings { waveSizeThreshold: number; } export interface CustomWaves { + /** Bosses spawn on raid start */ boss: Record; normal: Record; } +export interface IBotTypeLimit extends MinMax { + type: string; +} +/** Multiplier to apply to the loot count for a given map */ export interface LootMultiplier { bigmap: number; develop: number; 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/ILostOnDeathConfig.d.ts b/types/models/spt/config/ILostOnDeathConfig.d.ts index b557afe..3fb98fb 100644 --- a/types/models/spt/config/ILostOnDeathConfig.d.ts +++ b/types/models/spt/config/ILostOnDeathConfig.d.ts @@ -1,8 +1,11 @@ import { IBaseConfig } from "./IBaseConfig"; export interface ILostOnDeathConfig extends IBaseConfig { kind: "aki-lostondeath"; + /** What equipment in each slot should be lost on death */ equipment: Equipment; + /** Should special slot items be removed from quest inventory on death e.g. wifi camera/markers */ specialSlotItems: boolean; + /** Should quest items be removed from quest inventory on death */ questItems: boolean; } export interface Equipment { 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 87098da..0f74620 100644 --- a/types/models/spt/config/IPmcConfig.d.ts +++ b/types/models/spt/config/IPmcConfig.d.ts @@ -1,25 +1,51 @@ +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 */ + accountTypeWeight: Record; + /** Global whitelist/blacklist of vest loot for PMCs */ vestLoot: SlotLootSettings; + /** Global whitelist/blacklist of pocket loot for PMCs */ pocketLoot: SlotLootSettings; + /** Global whitelist/blacklist of backpack loot for PMCs */ backpackLoot: SlotLootSettings; dynamicLoot: DynamicLoot; + /** Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value */ useDifficultyOverride: boolean; + /** Difficulty override e.g. "AsOnline/Hard" */ 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 */ isUsec: number; + /** WildSpawnType enum value USEC PMCs use */ usecType: string; + /** WildSpawnType enum value BEAR PMCs use */ bearType: string; chanceSameSideIsHostilePercent: number; - /** key: location, value: type for usec/bear */ + /** What 'brain' does a PMC use, keyed by map and side (USEC/BEAR) key: map location, value: type for usec/bear */ pmcType: Record>>; maxBackpackLootTotalRub: number; maxPocketLootTotalRub: number; maxVestLootTotalRub: number; + /** Percentage chance a bot from a wave is converted into a PMC, key = bot wildspawn tpye (assault/exusec), value: min+max chance to be converted */ convertIntoPmcChance: Record; + /** WildSpawnType bots PMCs should see as hostile */ 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/IQuestConfig.d.ts b/types/models/spt/config/IQuestConfig.d.ts index 94c00fd..8ce461b 100644 --- a/types/models/spt/config/IQuestConfig.d.ts +++ b/types/models/spt/config/IQuestConfig.d.ts @@ -1,10 +1,14 @@ import { MinMax } from "../../../models/common/MinMax"; +import { SeasonalEventType } from "../../../models/enums/SeasonalEventType"; import { ELocationName } from "../../enums/ELocationName"; import { IBaseConfig } from "./IBaseConfig"; export interface IQuestConfig extends IBaseConfig { kind: "aki-quest"; redeemTime: number; questTemplateIds: IPlayerTypeQuestIds; + /** Show non-seasonal quests be shown to player */ + showNonSeasonalEventQuests: boolean; + eventQuests: Record; repeatableQuests: IRepeatableQuestConfig[]; locationIdMap: Record; bearOnlyQuests: string[]; @@ -19,6 +23,13 @@ export interface IQuestTypeIds { Completion: string; Exploration: string; } +export interface IEventQuestData { + name: string; + season: SeasonalEventType; + startTimestamp: number; + endTimestamp: number; + yearly: boolean; +} export interface IRepeatableQuestConfig { name: string; side: string; diff --git a/types/models/spt/config/IRagfairConfig.d.ts b/types/models/spt/config/IRagfairConfig.d.ts index 1eb640b..7aea24f 100644 --- a/types/models/spt/config/IRagfairConfig.d.ts +++ b/types/models/spt/config/IRagfairConfig.d.ts @@ -29,10 +29,8 @@ export interface Chance { overpriced: number; underpriced: number; } -export interface Time { +export interface Time extends MinMax { base: number; - min: number; - max: number; } export interface Reputation { gain: number; @@ -43,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 */ @@ -51,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; @@ -73,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 */ @@ -90,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; @@ -100,13 +116,13 @@ export interface OfferAdjustment { /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } -export interface Condition { +export interface Condition extends MinMax { /** Percentage change durability is altered */ conditionChance: number; - min: number; - max: number; } export interface Blacklist { + /** Damaged ammo packs */ + damagedAmmoPacks: boolean; /** Custom blacklist for item Tpls */ custom: string[]; /** BSG blacklist a large number of items from flea, true = use blacklist */ @@ -116,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/ISeasonalEventConfig.d.ts b/types/models/spt/config/ISeasonalEventConfig.d.ts index cedf9a9..7a5295c 100644 --- a/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,3 +1,4 @@ +import { SeasonalEventType } from "../../../models/enums/SeasonalEventType"; import { IBaseConfig } from "./IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { kind: "aki-seasonalevents"; @@ -9,6 +10,7 @@ export interface ISeasonalEventConfig extends IBaseConfig { } export interface ISeasonalEvent { name: string; + type: SeasonalEventType; startDay: number; startMonth: number; endDay: number; diff --git a/types/models/spt/config/ITraderConfig.d.ts b/types/models/spt/config/ITraderConfig.d.ts index 832f22a..85adf73 100644 --- a/types/models/spt/config/ITraderConfig.d.ts +++ b/types/models/spt/config/ITraderConfig.d.ts @@ -6,6 +6,7 @@ export interface ITraderConfig extends IBaseConfig { purchasesAreFoundInRaid: boolean; updateTimeDefault: number; traderPriceMultipler: number; + /** Keep track of purchased trader-limited items beyond server restarts to prevent server-restart item scumming */ persistPurchaseDataInProfile: boolean; fence: FenceConfig; } @@ -23,8 +24,16 @@ export interface FenceConfig { presetPriceMult: number; armorMaxDurabilityPercentMinMax: MinMax; presetMaxDurabilityPercentMinMax: MinMax; + /** Key: item tpl */ + 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[]; } export interface DiscountOptions { 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/dialog/ISendMessageDetails.d.ts b/types/models/spt/dialog/ISendMessageDetails.d.ts new file mode 100644 index 0000000..2f09733 --- /dev/null +++ b/types/models/spt/dialog/ISendMessageDetails.d.ts @@ -0,0 +1,30 @@ +import { Item } from "../../../models/eft/common/tables/IItem"; +import { ISystemData, IUserDialogInfo, MessageContentRagfair } from "../../../models/eft/profile/IAkiProfile"; +import { MessageType } from "../../../models/enums/MessageType"; +import { Traders } from "../../../models/enums/Traders"; +export interface ISendMessageDetails { + /** Player id */ + recipientId: string; + /** Who is sending this message */ + sender: MessageType; + /** Optional - leave blank to use sender value */ + dialogType?: MessageType; + /** Optional - if sender is USER these details are used */ + senderDetails?: IUserDialogInfo; + /** Optional - the trader sending the message */ + trader?: Traders; + /** Optional - used in player/system messages, otherwise templateId is used */ + messageText?: string; + /** Optinal - Items to send to player */ + items?: Item[]; + /** Optional - How long items will be stored in mail before expiry */ + itemsMaxStorageLifetimeSeconds?: number; + /** Optional - Used when sending messages from traders who send text from locale json */ + templateId?: string; + /** Optional - ragfair related */ + systemData?: ISystemData; + /** Optional - Used by ragfair messages */ + ragfairDetails?: MessageContentRagfair; + /** Optional - Usage not known, unsure of purpose, even dumps dont have it */ + profileChangeEvents?: any[]; +} 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/models/spt/server/ISettingsBase.d.ts b/types/models/spt/server/ISettingsBase.d.ts index 2870cfb..6be2ad4 100644 --- a/types/models/spt/server/ISettingsBase.d.ts +++ b/types/models/spt/server/ISettingsBase.d.ts @@ -27,6 +27,7 @@ export interface Config { TurnOffLogging: boolean; WeaponOverlapDistanceCulling: number; WebDiagnosticsEnabled: boolean; + NetworkStateView: INetworkStateView; } export interface FramerateLimit { MaxFramerateGameLimit: number; @@ -46,3 +47,7 @@ export interface ReleaseProfiler { MaxRecords: number; RecordTriggerValue: number; } +export interface INetworkStateView { + LossThreshold: number; + RttThreshold: number; +} diff --git a/types/models/spt/services/CustomPreset.d.ts b/types/models/spt/services/CustomPreset.d.ts index f07382e..785e0a4 100644 --- a/types/models/spt/services/CustomPreset.d.ts +++ b/types/models/spt/services/CustomPreset.d.ts @@ -1,5 +1,5 @@ -import { Preset } from "../../eft/common/IGlobals"; +import { IPreset } from "../../eft/common/IGlobals"; export interface CustomPreset { key: string; - preset: Preset; + preset: IPreset; } diff --git a/types/models/spt/services/LootRequest.d.ts b/types/models/spt/services/LootRequest.d.ts index 996a4de..044935d 100644 --- a/types/models/spt/services/LootRequest.d.ts +++ b/types/models/spt/services/LootRequest.d.ts @@ -2,6 +2,7 @@ import { MinMax } from "../../common/MinMax"; export interface LootRequest { presetCount: MinMax; itemCount: MinMax; + weaponCrateCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ 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/servers/http/AkiHttpListener.d.ts b/types/servers/http/AkiHttpListener.d.ts index d02861e..c72e18f 100644 --- a/types/servers/http/AkiHttpListener.d.ts +++ b/types/servers/http/AkiHttpListener.d.ts @@ -24,7 +24,7 @@ export declare class AkiHttpListener implements IHttpListener { handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; getResponse(sessionID: string, req: IncomingMessage, body: Buffer): string; - protected getBodyInfo(body: Buffer): any; + protected getBodyInfo(body: Buffer, requestUrl?: any): any; sendJson(resp: ServerResponse, output: string, sessionID: string): void; sendZlibJson(resp: ServerResponse, output: string, sessionID: string): void; } 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/BotEquipmentModPoolService.d.ts b/types/services/BotEquipmentModPoolService.d.ts index adf59ff..b81ff01 100644 --- a/types/services/BotEquipmentModPoolService.d.ts +++ b/types/services/BotEquipmentModPoolService.d.ts @@ -6,19 +6,21 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { VFS } from "../utils/VFS"; +import { LocalisationService } from "./LocalisationService"; /** Store a mapping between weapons, their slots and the items that fit those slots */ export declare class BotEquipmentModPoolService { protected logger: ILogger; protected vfs: VFS; protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected weaponModPool: Mods; protected gearModPool: Mods; protected weaponPoolGenerated: boolean; protected armorPoolGenerated: boolean; - constructor(logger: ILogger, vfs: VFS, itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(logger: ILogger, vfs: VFS, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); /** * Store dictionary of mods for each item passed in * @param items items to find related mods and store in modPool diff --git a/types/services/FenceService.d.ts b/types/services/FenceService.d.ts index 841a8ee..dfd8820 100644 --- a/types/services/FenceService.d.ts +++ b/types/services/FenceService.d.ts @@ -1,7 +1,7 @@ import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; -import { FenceLevel, Preset } from "../models/eft/common/IGlobals"; +import { IFenceLevel, IPreset } from "../models/eft/common/IGlobals"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; @@ -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 @@ -139,6 +139,12 @@ export declare class FenceService { current: number; max: number; }>, loyaltyLevel: number): void; + /** + * Get stack size ofr a singular item (no mods) + * @param itemDbDetails item being added to fence + * @returns Stack size + */ + protected getSingleItemStackCount(itemDbDetails: ITemplateItem): number; /** * Add preset weapons to fence presets * @param assortCount how many assorts to add to assorts @@ -146,7 +152,19 @@ export declare class FenceService { * @param assorts object to add presets to * @param loyaltyLevel loyalty level to requre item at */ - protected addPresets(desiredPresetCount: number, defaultWeaponPresets: Record, assorts: ITraderAssort, loyaltyLevel: number): void; + 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 @@ -176,7 +194,7 @@ export declare class FenceService { * @param pmcData Player profile * @returns FenceLevel object */ - getFenceInfo(pmcData: IPmcData): FenceLevel; + getFenceInfo(pmcData: IPmcData): IFenceLevel; /** * Remove an assort from fence by id * @param assortIdToRemove assort id to remove from fence assorts diff --git a/types/services/GiftService.d.ts b/types/services/GiftService.d.ts new file mode 100644 index 0000000..163635e --- /dev/null +++ b/types/services/GiftService.d.ts @@ -0,0 +1,50 @@ +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { GiftSentResult } from "../models/enums/GiftSentResult"; +import { MessageType } from "../models/enums/MessageType"; +import { Gift, IGiftsConfig } from "../models/spt/config/IGiftsConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { HashUtil } from "../utils/HashUtil"; +import { TimeUtil } from "../utils/TimeUtil"; +import { MailSendService } from "./MailSendService"; +export declare class GiftService { + protected logger: ILogger; + protected mailSendService: MailSendService; + protected hashUtil: HashUtil; + protected timeUtil: TimeUtil; + protected profileHelper: ProfileHelper; + protected configServer: ConfigServer; + protected giftConfig: IGiftsConfig; + constructor(logger: ILogger, mailSendService: MailSendService, hashUtil: HashUtil, timeUtil: TimeUtil, profileHelper: ProfileHelper, configServer: ConfigServer); + /** + * Does a gift with a specific ID exist in db + * @param giftId Gift id to check for + * @returns True if it exists in db + */ + giftExists(giftId: string): boolean; + /** + * Send player a gift from a range of sources + * @param playerId Player to send gift to / sessionId + * @param giftId Id of gift in configs/gifts.json to send player + * @returns outcome of sending gift to player + */ + sendGiftToPlayer(playerId: string, giftId: string): GiftSentResult; + /** + * Get sender id based on gifts sender type enum + * @param giftData Gift to send player + * @returns trader/user/system id + */ + protected getSenderId(giftData: Gift): string; + /** + * Convert GiftSenderType into a dialog MessageType + * @param giftData Gift to send player + * @returns MessageType enum value + */ + protected getMessageType(giftData: Gift): MessageType; + /** + * Prapor sends gifts to player for first week after profile creation + * @param sessionId Player id + * @param day What day to give gift for + */ + sendPraporStartingGift(sessionId: string, day: number): void; +} 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 32fffba..69bf0e4 100644 --- a/types/services/InsuranceService.d.ts +++ b/types/services/InsuranceService.d.ts @@ -1,27 +1,31 @@ import { ITraderBase } from "../models/eft/common/tables/ITrader"; import { DialogueHelper } from "../helpers/DialogueHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; -import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; 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; @@ -29,46 +33,60 @@ 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, 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; - insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; + /** + * Get all insured items by all traders for a profile + * @param sessionId Profile id (session id) + * @returns Item array + */ getInsurance(sessionId: string): Record; + /** + * Get insured items by profile id + trader id + * @param sessionId Profile id (session id) + * @param traderId Trader items were insured with + * @returns Item array + */ getInsuranceItems(sessionId: string, traderId: string): Item[]; resetInsurance(sessionId: string): void; - resetInsuranceTraderArray(sessionId: string, traderId: string): void; - addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: any): void; - /** - * Get the rouble price for an item by templateId - * @param itemTpl item tpl to get handbook price for - * @returns handbook price in roubles, Return 0 if not found - */ - getItemPrice(itemTpl: string): number; /** * Sends stored insured items as message to player - * @param pmcData profile to modify + * @param pmcData profile to send insured items to * @param sessionID SessionId of current player * @param mapId Id of the map player died/exited that caused the insurance to be issued on */ 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, locationName?: string): void; + /** + * Check all root insured items and remove location property + set slotId to 'hideout' + * @param sessionId Session id + * @param traderId Trader id */ - sendLostInsuranceMessage(sessionID: string): void; protected removeLocationProperty(sessionId: string, traderId: string): void; /** - * Get a timestamp of what insurance items should be sent to player based on the type of trader used to insure + * Get a timestamp of when insurance items should be sent to player based on trader used to insure + * Apply insurance return bonus if found in profile * @param pmcData Player profile - * @param trader Trader used to insure items + * @param trader Trader base used to insure items * @returns Timestamp to return items to player in seconds */ 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 @@ -76,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 @@ -84,11 +117,43 @@ 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(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) + * @param traderId Trader items insured with + * @returns True if exists + */ + protected insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; + /** + * Empty out array holding insured items by sessionid + traderid + * @param sessionId Player id (session id) + * @param traderId Trader items insured with + */ + resetInsuranceTraderArray(sessionId: string, traderId: string): void; + /** + * Store insured item + * @param sessionId Player id (session id) + * @param traderId Trader item insured with + * @param itemToAdd Insured item + */ + addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: Item): void; + /** + * Get price of insurance * multiplier from config + * @param pmcData Player profile + * @param inventoryItem Item to be insured + * @param traderId Trader item is insured with + * @returns price in roubles */ - protected addGearToSend(pmcData: IPmcData, insuredItem: InsuredItem, actualItem: Item, sessionID: string): void; getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number; } 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 new file mode 100644 index 0000000..1d49638 --- /dev/null +++ b/types/services/MailSendService.d.ts @@ -0,0 +1,129 @@ +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"; +import { Traders } from "../models/enums/Traders"; +import { ISendMessageDetails } from "../models/spt/dialog/ISendMessageDetails"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { SaveServer } from "../servers/SaveServer"; +import { HashUtil } from "../utils/HashUtil"; +import { TimeUtil } from "../utils/TimeUtil"; +import { LocalisationService } from "./LocalisationService"; +export declare class MailSendService { + protected logger: ILogger; + protected hashUtil: HashUtil; + protected timeUtil: TimeUtil; + 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, 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 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(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 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(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 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(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 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(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 available to simplify common actions + * @param messageDetails Details needed to send a message to the player + */ + sendMessageToPlayer(messageDetails: ISendMessageDetails): void; + /** + * Send a message from the player to an NPC + * @param sessionId Player id + * @param targetNpcId NPC message is sent to + * @param message Text to send to NPC + */ + sendPlayerMessageToNpc(sessionId: string, targetNpcId: string, message: string): void; + /** + * Create a message for storage inside a dialog in the player profile + * @param senderDialog Id of dialog that will hold the message + * @param messageDetails Various details on what the message must contain/do + * @returns Message + */ + protected createDialogMessage(dialogId: string, messageDetails: ISendMessageDetails): Message; + /** + * Add items to message and adjust various properties to reflect the items being added + * @param message Message to add items to + * @param itemsToSendToPlayer Items to add to message + * @param maxStorageTimeSeconds total time items are stored in mail before being deleted + */ + protected addRewardItemsToMessage(message: Message, itemsToSendToPlayer: MessageItems, maxStorageTimeSeconds: number): void; + /** + * perform various sanitising actions on the items before they're considered ready for insertion into message + * @param dialogType The type of the dialog that will hold the reward items being processed + * @param messageDetails + * @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 + * @param messageDetails Data on what message should do + * @returns Relevant Dialogue + */ + protected getDialog(messageDetails: ISendMessageDetails): Dialogue; + /** + * Get the appropriate sender id by the sender enum type + * @param messageDetails + * @returns gets an id of the individual sending it + */ + protected getMessageSenderIdByType(messageDetails: ISendMessageDetails): string; +} diff --git a/types/services/MatchBotDetailsCacheService.d.ts b/types/services/MatchBotDetailsCacheService.d.ts index 757f61f..c1bd322 100644 --- a/types/services/MatchBotDetailsCacheService.d.ts +++ b/types/services/MatchBotDetailsCacheService.d.ts @@ -1,10 +1,12 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; -/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +import { LocalisationService } from "./LocalisationService"; +/** 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; protected botDetailsCache: Record; - constructor(logger: ILogger); + constructor(logger: ILogger, localisationService: LocalisationService); /** * Store a bot in the cache, keyed by its name * @param botToCache Bot details to cache @@ -15,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/PlayerService.d.ts b/types/services/PlayerService.d.ts index 1195b93..458ce82 100644 --- a/types/services/PlayerService.d.ts +++ b/types/services/PlayerService.d.ts @@ -1,22 +1,27 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { TimeUtil } from "../utils/TimeUtil"; import { LocalisationService } from "./LocalisationService"; export declare class PlayerService { protected logger: ILogger; + protected timeUtil: TimeUtil; protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); + constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, databaseServer: DatabaseServer); /** - * increases the profile skill and updates any output - * @param {Object} pmcData - * @param {String} skillName - * @param {Number} amount + * Dupe of QuestHelper.rewardsSkillPoints() + * Add xp to a player skill + * @param pmcData Player profile + * @param skillName Name of skill to increment + * @param amount Amount of skill points to add to skill + * @param useSkillProgressRateMultipler Skills are multiplied by a value in globals, default is off to maintain compatibility with legacy code */ - incrementSkillLevel(pmcData: IPmcData, skillName: string, amount: number): void; + incrementSkillLevel(pmcData: IPmcData, skillName: string, amount: number, useSkillProgressRateMultipler?: boolean): void; /** - * @param {Object} pmcData - * @returns number + * Get level of player + * @param pmcData Player profile + * @returns Level of player */ calculateLevel(pmcData: IPmcData): number; } diff --git a/types/services/ProfileFixerService.d.ts b/types/services/ProfileFixerService.d.ts index 8d23ebc..bc1e42e 100644 --- a/types/services/ProfileFixerService.d.ts +++ b/types/services/ProfileFixerService.d.ts @@ -1,12 +1,20 @@ 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"; 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"; @@ -14,15 +22,28 @@ export declare class ProfileFixerService { protected logger: ILogger; 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; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, localisationService: LocalisationService, timeUtil: TimeUtil, databaseServer: DatabaseServer); + protected configServer: ConfigServer; + protected coreConfig: ICoreConfig; + 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 @@ -48,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 @@ -76,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 @@ -91,9 +110,10 @@ export declare class ProfileFixerService { protected getBonusFromProfile(profileBonuses: Bonus[], bonus: StageBonus): Bonus; /** * Checks profile inventiory for items that do not exist inside the items db + * @param sessionId Session id * @param pmcProfile Profile to check inventory of */ - checkForOrphanedModdedItems(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 @@ -109,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/RagfairLinkedItemService.d.ts b/types/services/RagfairLinkedItemService.d.ts index 51511f9..0fe4d15 100644 --- a/types/services/RagfairLinkedItemService.d.ts +++ b/types/services/RagfairLinkedItemService.d.ts @@ -4,9 +4,15 @@ import { DatabaseServer } from "../servers/DatabaseServer"; export declare class RagfairLinkedItemService { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; - protected linkedItemsCache: Record>; + protected linkedItemsCache: Record>; constructor(databaseServer: DatabaseServer, itemHelper: ItemHelper); - getLinkedItems(linkedSearchId: string): Iterable; + getLinkedItems(linkedSearchId: string): Set; + /** + * Use ragfair linked item service to get an array of items that can fit on or in designated itemtpl + * @param itemTpl Item to get sub-items for + * @returns ITemplateItem array + */ + getLinkedDbItems(itemTpl: string): ITemplateItem[]; /** * Create Dictionary of every item and the items associated with it */ @@ -17,5 +23,11 @@ export declare class RagfairLinkedItemService { * @param applyLinkedItems */ protected addRevolverCylinderAmmoToLinkedItems(cylinder: ITemplateItem, applyLinkedItems: (items: string[]) => void): void; + /** + * Scans a given slot type for filters and returns them as a Set + * @param item + * @param slot + * @returns array of ids + */ protected getFilters(item: ITemplateItem, slot: string): string[]; } diff --git a/types/services/RagfairPriceService.d.ts b/types/services/RagfairPriceService.d.ts index 8b68bc4..ff35327 100644 --- a/types/services/RagfairPriceService.d.ts +++ b/types/services/RagfairPriceService.d.ts @@ -3,7 +3,8 @@ import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { TraderHelper } from "../helpers/TraderHelper"; -import { Preset } from "../models/eft/common/IGlobals"; +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"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; @@ -12,6 +13,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RandomUtil } from "../utils/RandomUtil"; +import { LocalisationService } from "./LocalisationService"; /** * Stores flea prices for items as well as methods to interact with them */ @@ -23,12 +25,13 @@ export declare class RagfairPriceService implements OnLoad { protected presetHelper: PresetHelper; protected traderHelper: TraderHelper; protected randomUtil: RandomUtil; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; protected generatedDynamicPrices: boolean; protected generatedStaticPrices: boolean; protected prices: IRagfairServerPrices; - constructor(handbookHelper: HandbookHelper, databaseServer: DatabaseServer, logger: ILogger, itemHelper: ItemHelper, presetHelper: PresetHelper, traderHelper: TraderHelper, randomUtil: RandomUtil, configServer: ConfigServer); + constructor(handbookHelper: HandbookHelper, databaseServer: DatabaseServer, logger: ILogger, itemHelper: ItemHelper, presetHelper: PresetHelper, traderHelper: TraderHelper, randomUtil: RandomUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ @@ -85,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 @@ -98,16 +109,16 @@ 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 * @param items weapon plus mods * @param existingPrice price of existing base weapon - * @returns + * @returns price of weapon in roubles */ protected getWeaponPresetPrice(item: Item, items: Item[], existingPrice: number): number; /** @@ -122,8 +133,8 @@ export declare class RagfairPriceService implements OnLoad { * @param presets weapon presets to choose from * @returns Default preset object */ - protected getWeaponPreset(presets: Preset[], weapon: Item): { + protected getWeaponPreset(presets: IPreset[], weapon: Item): { isDefault: boolean; - preset: Preset; + preset: IPreset; }; } 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 820facb..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"; -import { ILogger } from "../models/spt/utils/ILogger"; -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 a3c6c7a..2fd22ed 100644 --- a/types/services/RepairService.d.ts +++ b/types/services/RepairService.d.ts @@ -14,6 +14,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RandomUtil } from "../utils/RandomUtil"; +import { LocalisationService } from "./LocalisationService"; import { PaymentService } from "./PaymentService"; export declare class RepairService { protected logger: ILogger; @@ -25,9 +26,10 @@ export declare class RepairService { protected weightedRandomHelper: WeightedRandomHelper; protected paymentService: PaymentService; protected repairHelper: RepairHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, questHelper: QuestHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, traderHelper: TraderHelper, weightedRandomHelper: WeightedRandomHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, questHelper: QuestHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, traderHelper: TraderHelper, weightedRandomHelper: WeightedRandomHelper, paymentService: PaymentService, repairHelper: RepairHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Use trader to repair an items durability * @param sessionID Session id @@ -92,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/services/SeasonalEventService.d.ts b/types/services/SeasonalEventService.d.ts index 7474018..9fb3454 100644 --- a/types/services/SeasonalEventService.d.ts +++ b/types/services/SeasonalEventService.d.ts @@ -1,20 +1,30 @@ import { BotHelper } from "../helpers/BotHelper"; -import { Config } from "../models/eft/common/IGlobals"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { IConfig } from "../models/eft/common/IGlobals"; import { Inventory } from "../models/eft/common/tables/IBotType"; +import { SeasonalEventType } from "../models/enums/SeasonalEventType"; +import { IHttpConfig } from "../models/spt/config/IHttpConfig"; +import { IQuestConfig } from "../models/spt/config/IQuestConfig"; import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { DatabaseImporter } from "../utils/DatabaseImporter"; +import { GiftService } from "./GiftService"; import { LocalisationService } from "./LocalisationService"; export declare class SeasonalEventService { protected logger: ILogger; protected databaseServer: DatabaseServer; + protected databaseImporter: DatabaseImporter; + protected giftService: GiftService; protected localisationService: LocalisationService; protected botHelper: BotHelper; + protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected seasonalEventConfig: ISeasonalEventConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, localisationService: LocalisationService, botHelper: BotHelper, configServer: ConfigServer); - protected get events(): Record; + protected questConfig: IQuestConfig; + protected httpConfig: IHttpConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, databaseImporter: DatabaseImporter, giftService: GiftService, localisationService: LocalisationService, botHelper: BotHelper, profileHelper: ProfileHelper, configServer: ConfigServer); protected get christmasEventItems(): string[]; protected get halloweenEventItems(): string[]; /** @@ -42,7 +52,7 @@ export declare class SeasonalEventService { */ getAllSeasonalEventItems(): string[]; /** - * Get an array of seasonal items that should be blocked as seasonal is not active + * Get an array of seasonal items that should be blocked as season is not currently active * @returns Array of tpl strings */ getSeasonalEventItemsToBlock(): string[]; @@ -52,12 +62,12 @@ export declare class SeasonalEventService { */ seasonalEventEnabled(): boolean; /** - * is christmas event active + * Is christmas event active (Globals eventtype array contains even name) * @returns true if active */ christmasEventEnabled(): boolean; /** - * is christmas event active + * is halloween event active (Globals eventtype array contains even name) * @returns true if active */ halloweenEventEnabled(): boolean; @@ -71,16 +81,24 @@ export declare class SeasonalEventService { * @param eventName Name of event to get gear changes for * @returns bots with equipment changes */ - protected getEventBotGear(eventName: string): Record>>; + protected getEventBotGear(eventType: SeasonalEventType): Record>>; /** * Get the dates each seasonal event starts and ends at * @returns Record with event name + start/end date */ getEventDetails(): ISeasonalEvent[]; /** - * Check if current date falls inside any of the seasons events pased in, if so, handle them + * Look up quest in configs/quest.json + * @param questId Quest to look up + * @param event event type (Christmas/Halloween/None) + * @returns true if related */ - checkForAndEnableSeasonalEvents(): void; + isQuestRelatedToEvent(questId: string, event: SeasonalEventType): boolean; + /** + * Check if current date falls inside any of the seasons events pased in, if so, handle them + * @param sessionId Players id + */ + checkForAndEnableSeasonalEvents(sessionId: string): void; /** * Iterate through bots inventory and loot to find and remove christmas items (as defined in SeasonalEventService) * @param nodeInventory Bots inventory to iterate over @@ -89,10 +107,16 @@ export declare class SeasonalEventService { removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; /** * Make adjusted to server code based on the name of the event passed in + * @param sessionId Player id * @param globalConfig globals.json * @param eventName Name of the event to enable. e.g. Christmas */ - protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + protected updateGlobalEvents(sessionId: string, globalConfig: IConfig, eventType: SeasonalEventType): void; + /** + * Change trader icons to be more event themed (Halloween only so far) + * @param eventType What event is active + */ + protected adjustTraderIcons(eventType: SeasonalEventType): void; /** * Add lootble items from backpack into patrol.ITEMS_TO_DROP difficulty property */ @@ -101,7 +125,7 @@ export declare class SeasonalEventService { * Read in data from seasonalEvents.json and add found equipment items to bots * @param eventName Name of the event to read equipment in from config */ - protected addEventGearToBots(eventName: string): void; + protected addEventGearToBots(eventType: SeasonalEventType): void; protected addPumpkinsToScavBackpacks(): void; /** * Set Khorovod(dancing tree) chance to 100% on all maps that support it @@ -111,4 +135,10 @@ export declare class SeasonalEventService { * Add santa to maps */ protected addGifterBotToMaps(): void; + /** + * Send gift to player if they'e not already received it + * @param playerId Player to send gift to + * @param giftkey Key of gift to give + */ + protected giveGift(playerId: string, giftkey: string): void; } diff --git a/types/services/TraderPurchasePersisterService.d.ts b/types/services/TraderPurchasePersisterService.d.ts index 7e7c88f..25b02ad 100644 --- a/types/services/TraderPurchasePersisterService.d.ts +++ b/types/services/TraderPurchasePersisterService.d.ts @@ -4,6 +4,7 @@ import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocalisationService } from "./LocalisationService"; /** * Help with storing limited item purchases from traders in profile to persist them over server restarts */ @@ -11,9 +12,10 @@ export declare class TraderPurchasePersisterService { protected logger: ILogger; protected timeUtil: TimeUtil; protected profileHelper: ProfileHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Get the purchases made from a trader for this profile before the last trader reset * @param sessionId Session id 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/DatabaseImporter.d.ts b/types/utils/DatabaseImporter.d.ts index 7698f07..b1afefc 100644 --- a/types/utils/DatabaseImporter.d.ts +++ b/types/utils/DatabaseImporter.d.ts @@ -26,20 +26,25 @@ export declare class DatabaseImporter implements OnLoad { private filepath; protected httpConfig: IHttpConfig; constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter, encodingUtil: EncodingUtil, hashUtil: HashUtil, importerUtil: ImporterUtil, configServer: ConfigServer); + /** + * Get path to aki data + * @returns path to data + */ + getSptDataPath(): string; onLoad(): Promise; /** * Read all json files in database folder and map into a json object * @param filepath path to database folder */ protected hydrateDatabase(filepath: string): Promise; - private onReadValidate; + protected onReadValidate(fileWithPath: string, data: string): void; getRoute(): string; - private validateFile; + protected validateFile(filePathAndName: string, fileData: any): boolean; /** * Find and map files with image router inside a designated path * @param filepath Path to find files in */ - loadImages(filepath: string, routes: string[]): void; + loadImages(filepath: string, directories: string[], routes: string[]): void; /** * Check for a path override in the http json config file * @param imagePath Key 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/RagfairOfferHolder.d.ts b/types/utils/RagfairOfferHolder.d.ts index 46d9e23..cc294da 100644 --- a/types/utils/RagfairOfferHolder.d.ts +++ b/types/utils/RagfairOfferHolder.d.ts @@ -1,8 +1,8 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; export declare class RagfairOfferHolder { - private offersById; - private offersByTemplate; - private offersByTrader; + protected offersById: Map; + protected offersByTemplate: Map>; + protected offersByTrader: Map>; constructor(); getOfferById(id: string): IRagfairOffer; getOffersByTemplate(templateId: string): Array; @@ -18,7 +18,7 @@ export declare class RagfairOfferHolder { * @returns IRagfairOffer array */ getStaleOffers(time: number): Array; - private addOfferByTemplates; - private addOfferByTrader; + protected addOfferByTemplates(template: string, offer: IRagfairOffer): void; + protected addOfferByTrader(trader: string, offer: IRagfairOffer): void; protected isStale(offer: IRagfairOffer, time: number): boolean; } diff --git a/types/utils/RandomUtil.d.ts b/types/utils/RandomUtil.d.ts index fc0b05d..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[]; } @@ -143,7 +143,7 @@ export declare class RandomUtil { * Drawing can be with or without replacement * @param {array} list The array we want to draw randomly from * @param {integer} count The number of times we want to draw - * @param {boolean} replacement Draw with or without replacement from the input array + * @param {boolean} replacement Draw with or without replacement from the input array(defult true) * @return {array} Array consisting of N random elements */ drawRandomFromList(list: Array, count?: number, replacement?: boolean): Array; diff --git a/types/utils/VFS.d.ts b/types/utils/VFS.d.ts index 267b10f..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,9 +46,11 @@ export declare class VFS { removeFileAsync(filepath: string): Promise; removeDir(filepath: string): void; removeDirAsync(filepath: string): Promise; - private lockFileSync; - private checkFileSync; - private unlockFileSync; + 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; getFileExtension(filepath: string): string; stripExtension(filepath: string): string; minifyAllJsonInDirRecursive(filepath: string): Promise; diff --git a/types/utils/Watermark.d.ts b/types/utils/Watermark.d.ts index f870cf1..fa63205 100644 --- a/types/utils/Watermark.d.ts +++ b/types/utils/Watermark.d.ts @@ -31,16 +31,17 @@ export declare class Watermark { */ getVersionTag(withEftVersion?: boolean): string; /** + * Handle singleplayer/settings/version * Get text shown in game on screen, can't be translated as it breaks bsgs client when certian characters are used * @returns string */ getInGameVersionLabel(): string; /** Set window title */ - setTitle(): void; + protected setTitle(): void; /** Reset console cursor to top */ - resetCursor(): void; + protected resetCursor(): void; /** Draw the watermark */ - draw(): void; + protected draw(): void; /** Caculate text length */ protected textLength(s: string): number; }